Re: [fw-general] Zend_Validate_Alnum
I agree. I'll vote for having this option! Regards, Bryce Lohr Darby Felton wrote: Łukasz Wojciechowski wrote: I think that Zend_Validate_Alnum shoudn't check if string is empty or not. You have other validator for this (NotEmpty), therefore the messages are duplicating if you want to combine ie. StringLength + Alnum. Can I turn off emptiness checking by Alnum? No, the emptiness check is behavior that is not configurable presently. If it is desirable to configure this behavior, however, please feel free to file an issue for it. We could make the behavior configurable, with the default being to check for emptiness for backward-compatibility. Thanks! Best regards, Darby
Re: [fw-general] Re: Zend_Form feature request: display group elements
-- Matthew Weier O'Phinney [EMAIL PROTECTED] wrote (on Monday, 11 February 2008, 12:53 PM -0500): -- Simon Mundy [EMAIL PROTECTED] wrote (on Sunday, 27 January 2008, 09:34 AM +1100): OK, using your sample form to illustrate my request:- $form-addElements(array( 'username' = 'text', 'password' = 'password', 'fullname' = 'text', 'email'= 'text', 'address' = 'text', 'postal' = 'text', 'submit' = 'submit', 'cancel' = 'submit' )) -addDisplayGroup(array('username', 'password'), 'login') -addDisplayGroup(array('fullname', 'email', 'address', 'postal'), 'demographics') -addDisplayGroup(array('submit', 'cancel'), 'actions'); Let's say instead you used instances of Zend_Form_Element instead of strings... $username = new Zend_Form_Element_Text('username'); $password = new Zend_Form_Element_Password('password'); $fullname = new Zend_Form_Element_Text('fullname'); ... etc. You can't do this:- -addDisplayGroup(array($username, $password), 'login') ...but I think there should be no difference - across the component you should be able to use either a string id of an element or the element itself when referring to methods that utilise one or more form elements. Similar to Zend_Acl... With regards to the addFormGroup functionality, I requested it simply because I can't see how you could ever sub-class a Form Group? It appears that it's hard-coded into the logic to add a display group. Allowing an 'addDisplayGroup' with an existing Zend_Form_DisplayGroup (or subclass) as the first method instead of an array would allow me to experiment with behaviours of the group and also free up the way I create forms. I see two paths here, both of which should be done. First, I'll add a couple of new settings to Zend_Form: a defaultDisplayGroupClass property, as well as an option in the options passed to addDisplayGroup(), displayGroupClass; these would allow you to substitute your own DisplayGroup subclass to utilize. I'll start work on that immediately. This part is now in current trunk. The second, and harder task would be to do as you suggest: allow adding concrete element instances to DisplayGroups, and then allow attaching concrete display group instances to a form. There are some definite issues with doing this, but nothing insurmountable. However, I consider it low priority for the time being, as I think only a small percentage of developers will need this sort of functionality, and the amount of code required for it will be necessarily high (when attaching a group, you'd then need to see if any elements match existing elements, and if not, add them to the form; what to do about plugin loader inheritance from the form to the display group; etc.) I can probably overcome these issues by having the display group have knowledge of its parent form, but will need to do some significant refactoring to do so. What is the use case for you? E.g., why do you want to instantiate display groups separately and add concrete elements to them instead of using addDisplayGroup and passing the element names? What problem does it solve? (Just gathering information here for the decision making process.) -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Re: Zend_Form feature request: display group elements
-- Simon Mundy [EMAIL PROTECTED] wrote (on Sunday, 27 January 2008, 09:34 AM +1100): OK, using your sample form to illustrate my request:- $form-addElements(array( 'username' = 'text', 'password' = 'password', 'fullname' = 'text', 'email'= 'text', 'address' = 'text', 'postal' = 'text', 'submit' = 'submit', 'cancel' = 'submit' )) -addDisplayGroup(array('username', 'password'), 'login') -addDisplayGroup(array('fullname', 'email', 'address', 'postal'), 'demographics') -addDisplayGroup(array('submit', 'cancel'), 'actions'); Let's say instead you used instances of Zend_Form_Element instead of strings... $username = new Zend_Form_Element_Text('username'); $password = new Zend_Form_Element_Password('password'); $fullname = new Zend_Form_Element_Text('fullname'); ... etc. You can't do this:- -addDisplayGroup(array($username, $password), 'login') ...but I think there should be no difference - across the component you should be able to use either a string id of an element or the element itself when referring to methods that utilise one or more form elements. Similar to Zend_Acl... With regards to the addFormGroup functionality, I requested it simply because I can't see how you could ever sub-class a Form Group? It appears that it's hard-coded into the logic to add a display group. Allowing an 'addDisplayGroup' with an existing Zend_Form_DisplayGroup (or subclass) as the first method instead of an array would allow me to experiment with behaviours of the group and also free up the way I create forms. I see two paths here, both of which should be done. First, I'll add a couple of new settings to Zend_Form: a defaultDisplayGroupClass property, as well as an option in the options passed to addDisplayGroup(), displayGroupClass; these would allow you to substitute your own DisplayGroup subclass to utilize. I'll start work on that immediately. The second, and harder task would be to do as you suggest: allow adding concrete element instances to DisplayGroups, and then allow attaching concrete display group instances to a form. There are some definite issues with doing this, but nothing insurmountable. However, I consider it low priority for the time being, as I think only a small percentage of developers will need this sort of functionality, and the amount of code required for it will be necessarily high (when attaching a group, you'd then need to see if any elements match existing elements, and if not, add them to the form; what to do about plugin loader inheritance from the form to the display group; etc.) I can probably overcome these issues by having the display group have knowledge of its parent form, but will need to do some significant refactoring to do so. What is the use case for you? E.g., why do you want to instantiate display groups separately and add concrete elements to them instead of using addDisplayGroup and passing the element names? What problem does it solve? (Just gathering information here for the decision making process.) -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] findDependentRowset - third parameter
I had to check the sources ... And the third parameter was added since 1.5 ! debussy007 wrote: Hello ! I can't get the third parameter of 'findDependentRowset' method to work ... My code is pretty simple, each Article has a set of photo's ArticlePhotos $articles = new Articles(); // - extends Zend_Db_Table_Abstract $myArticles = $articles-fetchAll($where, $order); $articlePhotos = new ArticlePhotos(); // - extends Zend_Db_Table_Abstract $selectPhotos= $articlePhotos-select()-where('to_delete = ?', 0); foreach ($myArticles as $article) { [...] echo $article-findDependentRowset('ArticlePhotos', null, $selectPhotos)-count(); [...] } Fatal error: Call to undefined method ArticlePhotos::select() in D:\websites\mysite\application\modules\partners\controllers\ArticlesController.php on line 26 I do not understand this error since there is a 'select()' method in the Zend_Db_Table_Abstract, so why there is a fatal error ? Then I tried to replace with : $selectPhotos= $articlePhotos-getAdapter()-select()-where('to_delete = ?', 0); The error disappears but the select specified in the third param of findDependentRowset has no effect. I should only count the rows that has as attribute to_delete = 0. Thank you for any help ! Matthew. -- View this message in context: http://www.nabble.com/findDependentRowset---third-parameter-tp15412760s16154p15416401.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Form and filtering data
Matthew Weier O'Phinney-3 wrote: By default, Zend_Form_Element_Submit uses the FormSubmit view helper to render the submit input tag. FormSubmit escapes the element value through Zend_View::escape() prior to rendering the tag -- by default through htmlentities. So, what's happening is that you're getting double-escaping. Ok, I understand better. If I put Zend_Filter_HtmlEntities() in a form element, the data will be escaped twice, once with the filter and once with Zend_View::escape(). So I think it doesn't need to add the Zend_Filter_HtmlEntities filter in any form because Zend_View::escape make already the escaping... I changed the view escape callback and it works better (I'm using a personnal escaping function because I encountered problems with FCKeditor). Thanks for your answer. -- View this message in context: http://www.nabble.com/Zend_Form-and-filtering-data-tp15412038s16154p15413542.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Log date format
Hi, I wonder why the date_format of Zend_Log is hardcoded (date('c')). Wouldn't it be nice to be able to attach a Zend_Date object to Zend_Log to accomplish this? I have two reasons: 1. I want to see milliseconds in my log for performance profiling 2. I want my log to be in UTC even my web application has other locale settings. Best regards, - Rainer -- View this message in context: http://www.nabble.com/Zend_Log-date-format-tp15413109s16154p15413109.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] findDependentRowset - third parameter
Hello ! I can't get the third parameter of 'findDependentRowset' method to work ... My code is pretty simple, each Article has a set of photo's ArticlePhotos $articles = new Articles(); // - extends Zend_Db_Table_Abstract $myArticles = $articles-fetchAll($where, $order); $articlePhotos = new ArticlePhotos(); // - extends Zend_Db_Table_Abstract $selectPhotos= $articlePhotos-select()-where('to_delete = ?', 0); foreach ($myArticles as $article) { [...] echo $article-findDependentRowset('ArticlePhotos', null, $selectPhotos)-count(); [...] } Fatal error: Call to undefined method Articles::select() in D:\websites\mysite\application\modules\partners\controllers\ArticlesController.php on line 26 I do not understand this error since there is a 'select()' method in the Zend_Db_Table_Abstract, so why there is a fatal error ? Then I tried to replace with : $selectPhotos= $articlePhotos-getAdapter()-select()-where('to_delete = ?', 0); The error disappears but the select specified in the third param of findDependentRowset has no effect. I should only count the rows that has as attribute to_delete = 0. Thank you for any help ! Matthew. -- View this message in context: http://www.nabble.com/findDependentRowset---third-parameter-tp15412760s16154p15412760.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] xinclude missing. cannot build docs from trunk
-- Julian Davchev [EMAIL PROTECTED] wrote (on Monday, 11 February 2008, 04:26 PM +0200): Hi, Using debian sidux here... and have hard time finding xinclude binary that I need for building docs from trunk xinclude --output html/index.html html.xsl manual.xml make: xinclude: Command not found So if anyone have a clue which package I need, will be more than helpful aptitude, apt-file couldn't help much... Make sure you have the following installed: * docbook * docbook-dsssl * docbook-utils * docbook-xml * docbook-xsl I'm not sure if only a subset of those are necessary, but I've got all of those on my ubuntu machine, and have no issues compiling the docs. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Zend_Form and filtering data
-- ALkyD [EMAIL PROTECTED] wrote (on Monday, 11 February 2008, 06:04 AM -0800): I'm using Zend_Form with Zend_Filter for elements, and I meet a weird problem about filtering when I submit the form... A form example : $form = new Zend_Form(); $form-setMethod('post'); $name = new Zend_Form_Element_Text('name'); $name-setLabel('Put your name here') -addFilter(new Zend_Filter_HtmlEntities()) -addValidator(new Zend_Validate_NotEmpty()); $form-addElement($name); $submit = new Zend_Form_Element_Submit('submit'); $form-addElement($submit); if ($this-_request-isPost()) { if ($form-isValid($_POST)) { // Process data } } If I put $name-setValue( é ) (e-acute), the character is immediately filtered with Zend_Filter_HtmlEntities and the displayed value in the text box is .eacute; (without the '.', because forum converts html tags). And when I submit the form, Zend_Filter_HtmlEntities process again, and the new value of my text box is .amp;eacute; ... By default, Zend_Form_Element_Submit uses the FormSubmit view helper to render the submit input tag. FormSubmit escapes the element value through Zend_View::escape() prior to rendering the tag -- by default through htmlentities. So, what's happening is that you're getting double-escaping. It is possible just filtering output data (when the form is submitted) and not input data (when I put data with setValue() or $form-populate() ) ? There is a request to modify the FormButton helper such that it renders a true button tag, and allows for optional disabling of escaping of the value. button tags can be used for submit, reset, or regular button inputs, so this will be the route you should take -- using a Button element, and specifying the button type. I will be updating FormButton sometime this week with that functionality. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] setErrorHandler / setExceptionHandler
-- Rainer Collet [EMAIL PROTECTED] wrote (on Monday, 11 February 2008, 07:32 AM -0800): is there any functionality in ZF to set the error/exception handlers? At the moment I implemented my own Zend_Exception which has static methods to set error and exception handler using Zend_Log, but I am not sure if this is the best way. There's nothing generi like this, no. In the MVC, there's an ErrorHandler plugin that catches exceptions in the dispatch loop and then allows you to display an error page; however, this happens within the dispatch loop, and will not catch regular unhandled exceptions. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Zend_Log date format
-- Rainer Collet [EMAIL PROTECTED] wrote (on Monday, 11 February 2008, 07:28 AM -0800): I wonder why the date_format of Zend_Log is hardcoded (date('c')). Wouldn't it be nice to be able to attach a Zend_Date object to Zend_Log to accomplish this? I have two reasons: 1. I want to see milliseconds in my log for performance profiling 2. I want my log to be in UTC even my web application has other locale settings. This sounds like a good and reasonable improvement; please place an issue in the tracker so we can implement it. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Zend_Translate::setCache()
Hi, Ok I see, I wrote some nonsense here, sorry. I meant the constructor of the adapter (Zend/Translate/Adapter.php). Ok your explanations made many things clearer.. So I should actually use something like this: $translate = new Zend_Translate('gettext', '/some/file.de.mo', 'de'); $translate-addTranslation('/some/file.en.mo', 'en'); and this will then add all different languages into one cache? Until now I loaded a different file with the Zend_Translate-constructor dependent on the language I want to output.. And then of course that language was cached, and I couln't use another one.. Greetings, Reto Kaiser On Feb 11, 2008 8:59 AM, Thomas Weidner [EMAIL PROTECTED] wrote: Hy reto, what do you mean with not utilized ? They are used within the adapter. And the constructor does not just return if he finds a cache... He calls setAdapter... and there the adapter is initialised and read. There is no return statement. Maybe you have used false settings ? And no the cache identifier should not contain the locale... There are formats out there where a file contains multiple locales. And as you can not know which locale is available you can also not set the locale there. This is one of the reasons why a single cache is used. Of course all translations use the same cache... To double all messageids for all locales would not only be useless but also a problem in speed if you use more then 2 languages. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com - Original Message - From: reto [EMAIL PROTECTED] To: Zend Mailing List fw-general@lists.zend.com; Thomas Weidner [EMAIL PROTECTED] Sent: Sunday, February 10, 2008 11:30 PM Subject: [fw-general] Zend_Translate::setCache() Hi Thomas, I just wanted to try the caching-feature of Zend_Translate. The problem I ran over is, that when I give the Zend_Translate()-constructor the parameters locale (and probably options) those are not utilized. This seems to be because if the constructor finds a cache for the translation it just returns. Another thought: Shouldn't the cache-identifier at least contain the locale? Because at the moment it's just Zend_Translate_Gettext for me. Wouldn't then all different translations use the same cache? Greetings, Reto Kaiser
Re: [fw-general] Dealing with Zend_Date ranges
Hi Thomas, Actually there is no proposal for such a functionality and I don't want to copy code from service classes to core just for fun. :-) I perfectly agree. I hope to commit the new web service proposal as soon as it will be completed thus you and everybody else will be able to give a look at this Date Range implementation and check whether it could be a standalone component. The API exposed by the class can be easily improved for a deep integration with other core components. If not it doesn't matter, it will only be part ot the web service component itself. :) Thanks, Simone On Mon, Feb 11, 2008 at 12:25 PM, Thomas Weidner [EMAIL PROTECTED] wrote: Hy Simon, this class is not intended to be a integrated part of Zend_Date. Actually there is no proposal for such a functionality and I don't want to copy code from service classes to core just for fun. :-) Keep in mind that I would then also have to support this class. From your description I also have 2 disappointments: 1.) the custom format you are using is completly false 2.) your api example is too complicated for most users So from what I actualy see it's a custom class of your service, but not part of the core for now. This can of course change in the future, depending on usability and response from others. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com - Original Message - From: Simone Carletti [EMAIL PROTECTED] To: Thomas Weidner [EMAIL PROTECTED] Sent: Monday, February 11, 2008 10:03 AM Subject: Re: [fw-general] Dealing with Zend_Date ranges Hi Thomas, you are right, however the DateRange object goes beyond a simple comparison between two dates. I've almost finished to build the class, I'll be glad if you will give a look in the future. Among all features, the class is able to: * hold a $from and $to date object * reorder the range to ensure $from is always the most recent timestamp * return the range in a custom format (for example, feedburner wants the range to be returned in -MM-DD,-MM-DD format) * add a time/date fragment starting from $from. For instance, $x = Range(Zend_Date::now()); $x-add('+5', Zend_Date::MINUTE) is equals to $x = Range(Zend_Date::now(), Zend_Date::now()-add('+5', Zend_Date::MINUTE)) and a few more features. This class is actually shipped with the new Zend_Service_FeedBurner proposal I'm working on, however it can easily extracted into a standalone Zend_Date_Range() object if we find it useful. :) -- Simone On Mon, Feb 11, 2008 at 8:49 AM, Thomas Weidner [EMAIL PROTECTED] wrote: It's all possible with the actual API with just a few single lines. There is no need of additional methods in my opinion. See for example the isEarlier and isLater methods within the API. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com - Original Message - From: Simone Carletti [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Sunday, February 10, 2008 11:38 PM Subject: [fw-general] Dealing with Zend_Date ranges Hi list, I'm working on a FeedBurner php client porting from an old PHP4 project I made time ago. Having a deep look at new FeedBurner API I noticed they use the concept of Date Range. Is anyone working on a Zend_Date_Range implementation? I'm creating a basic date range object for the new proposal and it would probably be a good starting point for a possibile Zend_Date_Range object. I also find a nice PERL date range implementation http://search.cpan.org/dist/Date-Range/lib/Date/Range.pm What do you think about the idea of a Zend_Date_Range class? -- Simone -- View this message in context: http://www.nabble.com/Dealing-with-Zend_Date-ranges-tp15402549s16154p15402549.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Weird Zend_Date behavior (may be a bug?)
Both dates were created without any time range thus I suppose 00:00:00 is used by default. The timezone was the same, I'm sure. It was the first setting I checked when the issue occured. Date calculation is not that easy... it's not just adding x days. I noticed! ;) Thanks for your support. -- Simone On Mon, Feb 11, 2008 at 12:34 PM, Thomas Weidner [EMAIL PROTECTED] wrote: Hy Simon, Just to satisfy my curiosity, how is it possible the other solution provided an earlier date? Two possible problems... You think that you've only worked with dates, but internally also the time is taken in account. So also the timezone is relevant. And the yearday is calculated in an other way than the day of month. Both in sum can be the reason why you got unexpected behaviour. I can say it just once more... Date calculation is not that easy... it's not just adding x days. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com - Original Message - From: Simone Carletti [EMAIL PROTECTED] To: Thomas Weidner [EMAIL PROTECTED] Cc: fw-general@lists.zend.com Sent: Monday, February 11, 2008 9:56 AM Subject: Re: [fw-general] Weird Zend_Date behavior (may be a bug?) Hi Thomas, I must admit I was hoping a feedback from you! ;) Thanks for taking part of this conversation. I just changed the format to -MM-dd and it worked as expected (at least now, I will try again tonight because it might depend on the timezone). Just to satisfy my curiosity, how is it possible the other solution provided an earlier date? Thanks, Simone On Mon, Feb 11, 2008 at 8:43 AM, Thomas Weidner [EMAIL PROTECTED] wrote: Hy Simon, just a question... Why are you using the DAY_OF_YEAR within your format if you only want the day ? Change you testdate to March or later and you will see your problem. If you want DAY you should also use it within your format... -MM-dd. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com - Original Message - From: Simone Carletti [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, February 11, 2008 2:08 AM Subject: [fw-general] Weird Zend_Date behavior (may be a bug?) Have a look at the following code fragment /** * Returns a range representation as required by FeedBurner API. */ public function getFeedBurnerRange() { static $format = '-MM-DD'; $this-order(); // reorder range $from = $this-getFrom(); $to = $this-getTo(); echo $from; if ($from === null) { /** * @see Zend_Service_FeedBurner_Awareness_Exception */ require_once 'Zend/Service/FeedBurner/Awareness/Exception.php'; throw new Zend_Service_FeedBurner_Awareness_Exception( Missing range start date); } if ($to === null) { $to = $this-setTo($from)-getTo(); } return $from-get($format) . ',' . $to-get($format); } Now look the following test public function testGetFeedBurnerRange() { $first = '2008-01-20'; $before = '2008-01-10'; $range = new Zend_Service_FeedBurner_Awareness_DateRange($first, $before); echo $range-getFrom(); $this-assertEquals($first,$before, $range-getFeedBurnerRange()); $range = new Zend_Service_FeedBurner_Awareness_DateRange($first, $before); $this-assertEquals($first,$before, $range-getFeedBurnerRange()); } It fails with the following reason 1) testGetFeedBurnerRange(Zend_Service_FeedBurner_Awareness_DateRangeTest) Failed asserting that two strings are equal. expected string 2008-01-20,2008-01-10 difference x got string 2008-01-19,2008-01-09 /Users/weppos/Sites/zend.com.framework/trunk/tests/Zend/Service/FeedBurner/Awareness/DateRangeTest.php:161 BUT... if instead of DD I use Zend_Date::DAY it works! (or at least return 20 and 10 as expected instead of 19 and 09. 1) testGetFeedBurnerRange(Zend_Service_FeedBurner_Awareness_DateRangeTest) Failed asserting that two strings are equal. expected string 2008-01-20,2008-01-10 differencexxx got string 20,10 /Users/weppos/Sites/zend.com.framework/trunk/tests/Zend/Service/FeedBurner/Awareness/DateRangeTest.php:161 How is it possibile? -- Simone -- View this message in context: http://www.nabble.com/Weird-Zend_Date-behavior-%28may-be-a-bug-%29-tp15403927s16154p15403927.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Validate_Alnum
I think that Zend_Validate_Alnum shoudn't check if string is empty or not. You have other validator for this (NotEmpty), therefore the messages are duplicating if you want to combine ie. StringLength + Alnum. Can I turn off emptiness checking by Alnum? -- Łukasz Wojciechowski
[fw-general] Zend_Date: set( XX ,Zend_Date::WEEK)
Dear list, I have some problems with Zend_Date: set( XX ,Zend_Date::WEEK) I need the start- and endday of a week. I try this: $date[0] = 7; $date[1] = 2008; $this-start-set($date[1],Zend_Date::YEAR); $this-start-set($date[0],Zend_Date::WEEK); $this-start-set('00:00:00',Zend_Date::TIMES); $this-end-set($date[1],Zend_Date::YEAR); $this-end-set($date[0],Zend_Date::WEEK); $this-end-set('23:59:59',Zend_Date::TIMES); In this case I get the rigtht week fom monday to sunday. If I try $date[0] = 7; $date[1] = 2006; I only get 7 days if I add $this-end-add(7,Zend_Date::DAY); But I get a week from saturday to friday. How can I always get monday to sunday? Greetings -- View this message in context: http://www.nabble.com/Zend_Date%3A-set%28-XX-%2CZend_Date%3A%3AWEEK%29-tp15409379s16154p15409379.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Dealing with Zend_Date ranges
Hi Thomas, you are right, however the DateRange object goes beyond a simple comparison between two dates. I've almost finished to build the class, I'll be glad if you will give a look in the future. Among all features, the class is able to: * hold a $from and $to date object * reorder the range to ensure $from is always the most recent timestamp * return the range in a custom format (for example, feedburner wants the range to be returned in -MM-DD,-MM-DD format) * add a time/date fragment starting from $from. For instance, $x = Range(Zend_Date::now()); $x-add('+5', Zend_Date::MINUTE) is equals to $x = Range(Zend_Date::now(), Zend_Date::now()-add('+5', Zend_Date::MINUTE)) and a few more features. This class is actually shipped with the new Zend_Service_FeedBurner proposal I'm working on, however it can easily extracted into a standalone Zend_Date_Range() object if we find it useful. :) -- Simone On Mon, Feb 11, 2008 at 8:49 AM, Thomas Weidner [EMAIL PROTECTED] wrote: It's all possible with the actual API with just a few single lines. There is no need of additional methods in my opinion. See for example the isEarlier and isLater methods within the API. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com - Original Message - From: Simone Carletti [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Sunday, February 10, 2008 11:38 PM Subject: [fw-general] Dealing with Zend_Date ranges Hi list, I'm working on a FeedBurner php client porting from an old PHP4 project I made time ago. Having a deep look at new FeedBurner API I noticed they use the concept of Date Range. Is anyone working on a Zend_Date_Range implementation? I'm creating a basic date range object for the new proposal and it would probably be a good starting point for a possibile Zend_Date_Range object. I also find a nice PERL date range implementation http://search.cpan.org/dist/Date-Range/lib/Date/Range.pm What do you think about the idea of a Zend_Date_Range class? -- Simone -- View this message in context: http://www.nabble.com/Dealing-with-Zend_Date-ranges-tp15402549s16154p15402549.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Weird Zend_Date behavior (may be a bug?)
Hi Thomas, I must admit I was hoping a feedback from you! ;) Thanks for taking part of this conversation. I just changed the format to -MM-dd and it worked as expected (at least now, I will try again tonight because it might depend on the timezone). Just to satisfy my curiosity, how is it possible the other solution provided an earlier date? Thanks, Simone On Mon, Feb 11, 2008 at 8:43 AM, Thomas Weidner [EMAIL PROTECTED] wrote: Hy Simon, just a question... Why are you using the DAY_OF_YEAR within your format if you only want the day ? Change you testdate to March or later and you will see your problem. If you want DAY you should also use it within your format... -MM-dd. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com - Original Message - From: Simone Carletti [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, February 11, 2008 2:08 AM Subject: [fw-general] Weird Zend_Date behavior (may be a bug?) Have a look at the following code fragment /** * Returns a range representation as required by FeedBurner API. */ public function getFeedBurnerRange() { static $format = '-MM-DD'; $this-order(); // reorder range $from = $this-getFrom(); $to = $this-getTo(); echo $from; if ($from === null) { /** * @see Zend_Service_FeedBurner_Awareness_Exception */ require_once 'Zend/Service/FeedBurner/Awareness/Exception.php'; throw new Zend_Service_FeedBurner_Awareness_Exception( Missing range start date); } if ($to === null) { $to = $this-setTo($from)-getTo(); } return $from-get($format) . ',' . $to-get($format); } Now look the following test public function testGetFeedBurnerRange() { $first = '2008-01-20'; $before = '2008-01-10'; $range = new Zend_Service_FeedBurner_Awareness_DateRange($first, $before); echo $range-getFrom(); $this-assertEquals($first,$before, $range-getFeedBurnerRange()); $range = new Zend_Service_FeedBurner_Awareness_DateRange($first, $before); $this-assertEquals($first,$before, $range-getFeedBurnerRange()); } It fails with the following reason 1) testGetFeedBurnerRange(Zend_Service_FeedBurner_Awareness_DateRangeTest) Failed asserting that two strings are equal. expected string 2008-01-20,2008-01-10 difference x got string 2008-01-19,2008-01-09 /Users/weppos/Sites/zend.com.framework/trunk/tests/Zend/Service/FeedBurner/Awareness/DateRangeTest.php:161 BUT... if instead of DD I use Zend_Date::DAY it works! (or at least return 20 and 10 as expected instead of 19 and 09. 1) testGetFeedBurnerRange(Zend_Service_FeedBurner_Awareness_DateRangeTest) Failed asserting that two strings are equal. expected string 2008-01-20,2008-01-10 differencexxx got string 20,10 /Users/weppos/Sites/zend.com.framework/trunk/tests/Zend/Service/FeedBurner/Awareness/DateRangeTest.php:161 How is it possibile? -- Simone -- View this message in context: http://www.nabble.com/Weird-Zend_Date-behavior-%28may-be-a-bug-%29-tp15403927s16154p15403927.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] setErrorHandler / setExceptionHandler
Hi, is there any functionality in ZF to set the error/exception handlers? At the moment I implemented my own Zend_Exception which has static methods to set error and exception handler using Zend_Log, but I am not sure if this is the best way. Best Regards, - Rainer -- View this message in context: http://www.nabble.com/setErrorHandler---setExceptionHandler-tp15413116s16154p15413116.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Validate_Alnum
Łukasz Wojciechowski wrote: I think that Zend_Validate_Alnum shoudn't check if string is empty or not. You have other validator for this (NotEmpty), therefore the messages are duplicating if you want to combine ie. StringLength + Alnum. Can I turn off emptiness checking by Alnum? No, the emptiness check is behavior that is not configurable presently. If it is desirable to configure this behavior, however, please feel free to file an issue for it. We could make the behavior configurable, with the default being to check for emptiness for backward-compatibility. Thanks! Best regards, Darby
Re: [fw-general] underscore in URL
-- ashish.sharma [EMAIL PROTECTED] wrote (on Sunday, 10 February 2008, 11:27 PM -0800): Hello Everybody, I would like to know that can we use underscores in URL (specially in controller action) like can we have a URL like .. Http:// localhost/my_application/my_module/my_controller/my_action As ZF removes underscores from the controller and action automatically. Do we have any alternative / solution for this, so that we can use underscores in controller and action name. looking for your suggestion ... Ashish Currently, there are two rules in play: * When referring to controllers, underscores are used to indicate that the controller lives in a subdirectory. In your example, 'my_controller' refers to a module living in 'My/ControllerController.php' in the module directory. * When referring to modules and actions, underscores are one of three word separators. Within the dispatcher, these are transliterated such that the words are camelCased and smashedTogether. In your examples, my_module becomes myModule, and my_action becomes myActionAction(). You can alter these within the dispatcher pretty easily by calling the setPathDelimiter() and setWordDelimiter() methods of the dispatcher. From your bootstrap, try the following: $dispatcher = $front-getDispatcher(); $dispatcher-setWordDelimiter(array('.', '-')) -setPathDelimiter(''); The above sets the word delimiters to solely the '.' and '-' characters, and effectively disables path delimiters. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Zend_Translate::setCache()
Look into the manual for automatic directory search in Zend_Translate to see how you can automate such things. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com - Original Message - From: reto [EMAIL PROTECTED] To: Thomas Weidner [EMAIL PROTECTED] Cc: Zend Mailing List fw-general@lists.zend.com Sent: Monday, February 11, 2008 1:32 PM Subject: Re: [fw-general] Zend_Translate::setCache() Hi, Ok I see, I wrote some nonsense here, sorry. I meant the constructor of the adapter (Zend/Translate/Adapter.php). Ok your explanations made many things clearer.. So I should actually use something like this: $translate = new Zend_Translate('gettext', '/some/file.de.mo', 'de'); $translate-addTranslation('/some/file.en.mo', 'en'); and this will then add all different languages into one cache? Until now I loaded a different file with the Zend_Translate-constructor dependent on the language I want to output.. And then of course that language was cached, and I couln't use another one.. Greetings, Reto Kaiser On Feb 11, 2008 8:59 AM, Thomas Weidner [EMAIL PROTECTED] wrote: Hy reto, what do you mean with not utilized ? They are used within the adapter. And the constructor does not just return if he finds a cache... He calls setAdapter... and there the adapter is initialised and read. There is no return statement. Maybe you have used false settings ? And no the cache identifier should not contain the locale... There are formats out there where a file contains multiple locales. And as you can not know which locale is available you can also not set the locale there. This is one of the reasons why a single cache is used. Of course all translations use the same cache... To double all messageids for all locales would not only be useless but also a problem in speed if you use more then 2 languages. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com - Original Message - From: reto [EMAIL PROTECTED] To: Zend Mailing List fw-general@lists.zend.com; Thomas Weidner [EMAIL PROTECTED] Sent: Sunday, February 10, 2008 11:30 PM Subject: [fw-general] Zend_Translate::setCache() Hi Thomas, I just wanted to try the caching-feature of Zend_Translate. The problem I ran over is, that when I give the Zend_Translate()-constructor the parameters locale (and probably options) those are not utilized. This seems to be because if the constructor finds a cache for the translation it just returns. Another thought: Shouldn't the cache-identifier at least contain the locale? Because at the moment it's just Zend_Translate_Gettext for me. Wouldn't then all different translations use the same cache? Greetings, Reto Kaiser
Re: [fw-general] Weird Zend_Date behavior (may be a bug?)
Hy Simon, Just to satisfy my curiosity, how is it possible the other solution provided an earlier date? Two possible problems... You think that you've only worked with dates, but internally also the time is taken in account. So also the timezone is relevant. And the yearday is calculated in an other way than the day of month. Both in sum can be the reason why you got unexpected behaviour. I can say it just once more... Date calculation is not that easy... it's not just adding x days. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com - Original Message - From: Simone Carletti [EMAIL PROTECTED] To: Thomas Weidner [EMAIL PROTECTED] Cc: fw-general@lists.zend.com Sent: Monday, February 11, 2008 9:56 AM Subject: Re: [fw-general] Weird Zend_Date behavior (may be a bug?) Hi Thomas, I must admit I was hoping a feedback from you! ;) Thanks for taking part of this conversation. I just changed the format to -MM-dd and it worked as expected (at least now, I will try again tonight because it might depend on the timezone). Just to satisfy my curiosity, how is it possible the other solution provided an earlier date? Thanks, Simone On Mon, Feb 11, 2008 at 8:43 AM, Thomas Weidner [EMAIL PROTECTED] wrote: Hy Simon, just a question... Why are you using the DAY_OF_YEAR within your format if you only want the day ? Change you testdate to March or later and you will see your problem. If you want DAY you should also use it within your format... -MM-dd. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com - Original Message - From: Simone Carletti [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, February 11, 2008 2:08 AM Subject: [fw-general] Weird Zend_Date behavior (may be a bug?) Have a look at the following code fragment /** * Returns a range representation as required by FeedBurner API. */ public function getFeedBurnerRange() { static $format = '-MM-DD'; $this-order(); // reorder range $from = $this-getFrom(); $to = $this-getTo(); echo $from; if ($from === null) { /** * @see Zend_Service_FeedBurner_Awareness_Exception */ require_once 'Zend/Service/FeedBurner/Awareness/Exception.php'; throw new Zend_Service_FeedBurner_Awareness_Exception( Missing range start date); } if ($to === null) { $to = $this-setTo($from)-getTo(); } return $from-get($format) . ',' . $to-get($format); } Now look the following test public function testGetFeedBurnerRange() { $first = '2008-01-20'; $before = '2008-01-10'; $range = new Zend_Service_FeedBurner_Awareness_DateRange($first, $before); echo $range-getFrom(); $this-assertEquals($first,$before, $range-getFeedBurnerRange()); $range = new Zend_Service_FeedBurner_Awareness_DateRange($first, $before); $this-assertEquals($first,$before, $range-getFeedBurnerRange()); } It fails with the following reason 1) testGetFeedBurnerRange(Zend_Service_FeedBurner_Awareness_DateRangeTest) Failed asserting that two strings are equal. expected string 2008-01-20,2008-01-10 difference x got string 2008-01-19,2008-01-09 /Users/weppos/Sites/zend.com.framework/trunk/tests/Zend/Service/FeedBurner/Awareness/DateRangeTest.php:161 BUT... if instead of DD I use Zend_Date::DAY it works! (or at least return 20 and 10 as expected instead of 19 and 09. 1) testGetFeedBurnerRange(Zend_Service_FeedBurner_Awareness_DateRangeTest) Failed asserting that two strings are equal. expected string 2008-01-20,2008-01-10 differencexxx got string 20,10 /Users/weppos/Sites/zend.com.framework/trunk/tests/Zend/Service/FeedBurner/Awareness/DateRangeTest.php:161 How is it possibile? -- Simone -- View this message in context: http://www.nabble.com/Weird-Zend_Date-behavior-%28may-be-a-bug-%29-tp15403927s16154p15403927.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Form and filtering data
Hello, I'm using Zend_Form with Zend_Filter for elements, and I meet a weird problem about filtering when I submit the form... A form example : $form = new Zend_Form(); $form-setMethod('post'); $name = new Zend_Form_Element_Text('name'); $name-setLabel('Put your name here') -addFilter(new Zend_Filter_HtmlEntities()) -addValidator(new Zend_Validate_NotEmpty()); $form-addElement($name); $submit = new Zend_Form_Element_Submit('submit'); $form-addElement($submit); if ($this-_request-isPost()) { if ($form-isValid($_POST)) { // Process data } } If I put $name-setValue( é ) (e-acute), the character is immediately filtered with Zend_Filter_HtmlEntities and the displayed value in the text box is .eacute; (without the '.', because forum converts html tags). And when I submit the form, Zend_Filter_HtmlEntities process again, and the new value of my text box is .amp;eacute; ... It is possible just filtering output data (when the form is submitted) and not input data (when I put data with setValue() or $form-populate() ) ? http://zend-form.tjeu.be/user/signup This Zend_Form demo does not have this problem, but the latest version of ZF seems to have it... Any idea ? Thanks (and sorry for my bad english). -- View this message in context: http://www.nabble.com/Zend_Form-and-filtering-data-tp15412038s16154p15412038.html Sent from the Zend Framework mailing list archive at Nabble.com.