[PHP] PHP6 return by reference deprecation

2009-05-01 Thread Paul M Foster
In another thread (which I mercifully declined to highjack), someone
cited:

> Taken from http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html

And I read this:

Both '$foo =& new StdClass()' and 'function &foo' will now raise an
E_STRICT error.

I don't use this much, but where I do, it's vital. Typically, I use it
to ensure a single copy of the $config for an application, as:

function &get_config() ...

and/or:

$cfg =& get_config();

If this is going away, how do you return things by reference, so as to
ensure a single copy of something (yes, I know the singleton pattern can
be used; I do use it as well; it's more complicated)?

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] SOAP and Exception Handling

2009-05-01 Thread VamVan
Hello Guys,

I use SOAP calls to make web service requests.I have a class that does
webservice calls to various wsdls. So my question is about try catch blocks.

so my method looks like this:

private function method($cookie){
  //Define Client
  try{
  // Check if WSDL exists
  if(!...@file_get_contents($this->WSDL)) {
throw new SoapFault('Server', 'No WSDL found at ' .
$this->WSDL);
  }
  $client = new SoapClient($this->WSDL, array(
  'exceptions' => 1,
  'encoding' => "UTF-8",
  'connection_timeout' => 60
  ));
  }catch(SoapFault $fault){
  // Error if the WSDL is not available or new client cannot be made
  //log errror
  }
  //Define Input Array
$input = array();
$input['cookie'] = $cookie;

//Make the call
  try{
  $result = $client->function($input);// Make the Call
  return $result;
  }catch(SoapFault $fault){
//log error
  }
   }

How is it possible for me to *remove *these 2 try and catch blocks from this
method and just throw exceptions, but do a try and catch in the business
logic.

So basically I might have different functions in  business logic area that
might call the same method and I do error logging there itself instead
directly in the method?

Thanks,
V


[PHP] Re: graphical integrated development environment recommendations?

2009-05-01 Thread Shawn McKenzie
Adam Williams wrote:
> With the wide range of users on the list, I'm sure there are plenty of
> opinions on what are good graphical IDE's and which ones to avoid.  I'd
> like to get away from using notepad.exe to code with due to its
> limitations.  Something that supports syntax/code highlighting and has
> browser previews would be nice features.  I'm looking at Aptana
> (www.aptana.com) but it seems like it is more complicated to use then it
> should be.  Either Linux or Windows IDE (i run both OSes)
> recommendations would be fine.
> 

I used eclispe, but I'm using netbeans now.  Runs on win and linux.
Just to edit a file here and there I use kate on linux (many text
editors have highlighting/folding on linux) and notepad++ when I have to
be on windows.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] graphical integrated development environment recommendations?

2009-05-01 Thread Andrew Hucks
http://notepad-plus.sourceforge.net/uk/site.htm

Try out N++. It's very good, supports a whole bunch of languages by
default, has folding, and you can tweak the syntax highlight if you
want. (You don't need to though.)

Takes two minutes to install, and 45 seconds to uninstall it if you
don't like it. It's worth a try.

On Fri, May 1, 2009 at 12:08 PM, Adam Williams
 wrote:
> With the wide range of users on the list, I'm sure there are plenty of
> opinions on what are good graphical IDE's and which ones to avoid.  I'd like
> to get away from using notepad.exe to code with due to its limitations.
>  Something that supports syntax/code highlighting and has browser previews
> would be nice features.  I'm looking at Aptana (www.aptana.com) but it seems
> like it is more complicated to use then it should be.  Either Linux or
> Windows IDE (i run both OSes) recommendations would be fine.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] graphical integrated development environment recommendations?

2009-05-01 Thread listmail
On Fri, 01 May 2009 12:57:25 -0400
Al  wrote:

> 
> 
> Michael A. Peters wrote:
> > Adam Williams wrote:
> >> With the wide range of users on the list, I'm sure there are
> >> plenty of opinions on what are good graphical IDE's and which ones
> >> to avoid. I'd like to get away from using notepad.exe to code with
> >> due to its limitations.  Something that supports syntax/code
> >> highlighting and has browser previews would be nice features.  I'm
> >> looking at Aptana (www.aptana.com) but it seems like it is more
> >> complicated to use then it should be.  Either Linux or Windows IDE
> >> (i run both OSes) recommendations would be fine.
> >>
> >>
> > 
> > Not an ide - I use bluefish, which is a gui text editor with syntax 
> > highlighting. It's an X11/gtk2+ application, packaged for most
> > Linux distribution (ie yum install bluefish on Fedora or RHEL)
> > 
> > For previewing, I just run a web server on my development box.
> > 
> > Only hitch with bluefish - the syntax highlighting sometimes gets 
> > confused and it drops the highlighting. Press F5 and it reloads.
> > 
> > I believe there is a windows port of bluefish but if I was on
> > windows, I'd probably just use Homesite (not free).
> 
> Look at phpEdit. It has everything you are looking for and is rock
> solid. I love the folding and regions features.
> 

Isn't phpedit windows-only?



Eclipse + PDT is my recommendation FWIW...

GM

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] graphical integrated development environment recommendations?

2009-05-01 Thread Al



Michael A. Peters wrote:

Adam Williams wrote:
With the wide range of users on the list, I'm sure there are plenty of 
opinions on what are good graphical IDE's and which ones to avoid.  
I'd like to get away from using notepad.exe to code with due to its 
limitations.  Something that supports syntax/code highlighting and has 
browser previews would be nice features.  I'm looking at Aptana 
(www.aptana.com) but it seems like it is more complicated to use then 
it should be.  Either Linux or Windows IDE (i run both OSes) 
recommendations would be fine.





Not an ide - I use bluefish, which is a gui text editor with syntax 
highlighting. It's an X11/gtk2+ application, packaged for most Linux 
distribution (ie yum install bluefish on Fedora or RHEL)


For previewing, I just run a web server on my development box.

Only hitch with bluefish - the syntax highlighting sometimes gets 
confused and it drops the highlighting. Press F5 and it reloads.


I believe there is a windows port of bluefish but if I was on windows, 
I'd probably just use Homesite (not free).


Look at phpEdit. It has everything you are looking for and is rock solid. I love the folding and 
regions features.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Upload file name not file

2009-05-01 Thread Simon
On Fri, May 1, 2009 at 9:34 AM, MikeP  wrote:
> I'm not trying to get the path, just the filename and size, I know how to
> get these, but that would include the file using $_Files, but I dont want to
> upload anything just use the filename and size.(without the path) to insert
> into a DB.

Those are attributes of the file for which you dont have access
remotely, and the only way to access this information without an
upload will be using the same hacks as those spywarez use.  A
technology like flash has read/write access to the remote user's disk
(to a certain extent), you could use flash to get that information and
make it send it to you, same thing could be done with ActiveX, etc...
PHP, JS and HTTP protocol cannot acheive what you want.  (PHP is
server-side, HTTP is for communication only, JS is client-side but
locked down very much).

However, at a very low level, it might be possible to achieve this in
PHP, you could do the upload as if you wanted the whole file.  But the
first packet received will contain the HTTP Header, and in the header,
you should have all the info you need (filename and size of data).
So, low-level speaking, as soon as you receive the first packet and
have the info, you just need to close the connection (remote end might
display an error msg saying the upload failed, etc).  PHP supports
sockets connections, so you could make a basic 'server' that listens
on another port to perform this.  But i see no way to acheive your
goal without complications.

Good luck!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] graphical integrated development environment recommendations?

2009-05-01 Thread Michael A. Peters

Adam Williams wrote:
With the wide range of users on the list, I'm sure there are plenty of 
opinions on what are good graphical IDE's and which ones to avoid.  I'd 
like to get away from using notepad.exe to code with due to its 
limitations.  Something that supports syntax/code highlighting and has 
browser previews would be nice features.  I'm looking at Aptana 
(www.aptana.com) but it seems like it is more complicated to use then it 
should be.  Either Linux or Windows IDE (i run both OSes) 
recommendations would be fine.





Not an ide - I use bluefish, which is a gui text editor with syntax 
highlighting. It's an X11/gtk2+ application, packaged for most Linux 
distribution (ie yum install bluefish on Fedora or RHEL)


For previewing, I just run a web server on my development box.

Only hitch with bluefish - the syntax highlighting sometimes gets 
confused and it drops the highlighting. Press F5 and it reloads.


I believe there is a windows port of bluefish but if I was on windows, 
I'd probably just use Homesite (not free).


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] object literals

2009-05-01 Thread Robert Cummings
On Fri, 2009-05-01 at 17:52 +0200, Andrea Giammarchi wrote:
> you are in PHP, not in JavaScript.
> 
> In PHP arrays are like collections or hash tables.
> if you strictly need object cause
> 
> $o->stuff
> is better than
> $o['stuff']
> 
> having exactly the same number of characters, you can create a
> function like
> 
> function o(array $a){
>  $o = new stdClass;
>  foreach($a as $key => $value)
>  $o->$key = $value;
>  return $o;
> }
> 
> 
> and the syntax will be
> 
> $o = o(array(
> 'a' => "b",
> 'c' => "d"
> ));
> 
> spot the difference from (object) array(whatever) ?
> 
> I do not ... and that's why json_encode resolves associative arrays
> rather than list automatically but still, if you are in PHP, you
> should think about being familiar with associative arrays, also
> because so far is the only class you cannot create/extend.
> 
> class string {
> // ok
> }
> 
> class object {
> // ok
> }
> 
> class array {
> // no way
> }
> 
> Regards

First off, you compared the syntax between creating a PHP array and a
JavaScript object when the previous post specifically spoke about
getting a PHP "OBJECT". Now you've made a rather lengthy and redundant
post trying to describe to me objects versus arrays in PHP. Lastly
you've suggested writing a function to convert an array to an object
using a foreach loop for the members which is completely unnecessary.
The following will suffice:



... and the syntax will be:

 "b",
'c' => "d",
));

?>

But why bother when you could have just done:

 "b",
'c' => "d",
);

?>

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] graphical integrated development environment recommendations?

2009-05-01 Thread Adam Williams
With the wide range of users on the list, I'm sure there are plenty of 
opinions on what are good graphical IDE's and which ones to avoid.  I'd 
like to get away from using notepad.exe to code with due to its 
limitations.  Something that supports syntax/code highlighting and has 
browser previews would be nice features.  I'm looking at Aptana 
(www.aptana.com) but it seems like it is more complicated to use then it 
should be.  Either Linux or Windows IDE (i run both OSes) 
recommendations would be fine.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] object literals

2009-05-01 Thread Andrea Giammarchi

ooops sorry, two more ;-)

> having exactly the same number of characterss.aspx

_
Windows Live™: Keep your life in sync. Check it out!
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009

RE: [PHP] object literals

2009-05-01 Thread Andrea Giammarchi

you are in PHP, not in JavaScript.

In PHP arrays are like collections or hash tables.
if you strictly need object cause

$o->stuff
is better than
$o['stuff']

having exactly the same number of characters, you can create a function like

function o(array $a){
 $o = new stdClass;
 foreach($a as $key => $value)
 $o->$key = $value;
 return $o;
}


and the syntax will be

$o = o(array(
'a' => "b",
'c' => "d"
));

spot the difference from (object) array(whatever) ?

I do not ... and that's why json_encode resolves associative arrays rather than 
list automatically but still, if you are in PHP, you should think about being 
familiar with associative arrays, also because so far is the only class you 
cannot create/extend.

class string {
// ok
}

class object {
// ok
}

class array {
// no way
}

Regards

> From: rob...@interjinn.com
> To: an_...@hotmail.com
> CC: f...@thefsb.org; php-general@lists.php.net
> Date: Fri, 1 May 2009 11:40:11 -0400
> Subject: RE: [PHP] object literals
> 
> On Fri, 2009-05-01 at 17:36 +0200, Andrea Giammarchi wrote:
> > var o = {
> > "a" : "b",
> > "c" : "d"
> > };
> > 
> > $o = array(
> > 'a' => "b",
> > 'c' => "d"
> > );
> > 
> > so I guess the problem is a couple of quotes, isn't it?
> > 
> > 
> > otherwise define object statically and externally and use json_decode ;-)
> 
> You made an array-- not an object.
> 
> Cheers,
> Rob.
> -- 
> http://www.interjinn.com
> Application and Templating Framework for PHP
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx

RE: [PHP] object literals

2009-05-01 Thread Robert Cummings
On Fri, 2009-05-01 at 17:36 +0200, Andrea Giammarchi wrote:
> var o = {
> "a" : "b",
> "c" : "d"
> };
> 
> $o = array(
> 'a' => "b",
> 'c' => "d"
> );
> 
> so I guess the problem is a couple of quotes, isn't it?
> 
> 
> otherwise define object statically and externally and use json_decode ;-)

You made an array-- not an object.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] object literals

2009-05-01 Thread Andrea Giammarchi

var o = {
"a" : "b",
"c" : "d"
};

$o = array(
'a' => "b",
'c' => "d"
);

so I guess the problem is a couple of quotes, isn't it?


otherwise define object statically and externally and use json_decode ;-)




> Date: Thu, 30 Apr 2009 16:56:21 -0400
> From: f...@thefsb.org
> To: php-general@lists.php.net
> Subject: [PHP] object literals
> 
> is there a neat literal syntax for creating objects on the fly without
> defining a type?
> 
> whenever i need to do it i do something like
> 
> $x = (object) array('a'=>1, 'b'=>3, ...);
> 
> which works but isn't very lovely. it's neater in, for example, javascript.
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx

Re: [PHP] object literals

2009-05-01 Thread Tom Worster
On 5/1/09 4:54 AM, "Richard Heyes"  wrote:

> Hi,
> 
>>    $x = (object) array('a'=>1, 'b'=>3, ...);
>> 
>> which works but isn't very lovely. it's neater in, for example, javascript.
> 
> Well, you could wrap it up in a function to make it a bit lovelier. Eg:
> 
> $foo = createObject(array('key' => 'value'));
> 
> It's not great, but PHP doesn't have a object literal syntax AFAIK.

thanks. i really wanted to confirm that it's absent from the language. i've
been unsure for years if it's somewhere in the manual and i just can't find
it.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] output buffer with Chrome issue.

2009-05-01 Thread Dan Joseph
On Fri, May 1, 2009 at 10:55 AM, Robert Cummings wrote:

>
> I presume your backend script is running something that passes the data
> to the browser un-interrupted... maybe a shell script? You can wrap this
> in popen() or proc_open() and read the output as you would a file. This
> can then be queued for consumption by an AJAX script.
>
>
Ah ok, I've never used either of those before.  I am going to give that a
shot and will let you know how it goes.  I should be able to bolt that on
quickly.  Thanks!

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.


Re: [PHP] output buffer with Chrome issue.

2009-05-01 Thread Robert Cummings
On Fri, 2009-05-01 at 10:42 -0400, Dan Joseph wrote:
> On Fri, May 1, 2009 at 10:40 AM, Robert Cummings wrote:
> 
> > On Fri, 2009-05-01 at 10:34 -0400, Dan Joseph wrote:
> > >
> > > Ajax unfortunately isn't an option in this particular case.
> >
> > Why? Maybe you're thinking about it wrong.
> >
> >
> Maybe, I'm open to suggestions:
> 
> Here's the basic way the application works.   main index renders, javascript
> runs to create an iframe, and set the src='phpfile.php' that runs in a
> continuous loop.  it connects to the server, and then listens for output.
> 
> Disconnecting from the server isn't an option at all, or else the
> application will not function properly.  It needs to have the constant
> "stream" to the server.
> 
> Is there a better solution for this?

I presume your backend script is running something that passes the data
to the browser un-interrupted... maybe a shell script? You can wrap this
in popen() or proc_open() and read the output as you would a file. This
can then be queued for consumption by an AJAX script.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] how to write element in textarea?

2009-05-01 Thread Andrew Ballard
On Fri, May 1, 2009 at 10:44 AM, Grega Leskovsek  wrote:
> I am writing CMS, that will be able to edit files.
> For editing I put file inside textarea, but when I open file that has
> textarea element inside it I lose (read: don't show data in the
> textarea element.) the data after the inside  element.
> Any suggestions how can I fix this?
>
> Thanks in advance,
>

You need to use htmlspecialchars on whatever you place inside the textarea:




Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] how to write element in textarea?

2009-05-01 Thread Grega Leskovsek
I am writing CMS, that will be able to edit files.
For editing I put file inside textarea, but when I open file that has
textarea element inside it I lose (read: don't show data in the
textarea element.) the data after the inside  element.
Any suggestions how can I fix this?

Thanks in advance,

-- 
When the sun rises I receive and when it sets I forgive ->
http://users.skavt.net/~gleskovs/
All the Love, Grega Leskov'sek

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] output buffer with Chrome issue.

2009-05-01 Thread Dan Joseph
On Fri, May 1, 2009 at 10:40 AM, Robert Cummings wrote:

> On Fri, 2009-05-01 at 10:34 -0400, Dan Joseph wrote:
> >
> > Ajax unfortunately isn't an option in this particular case.
>
> Why? Maybe you're thinking about it wrong.
>
>
Maybe, I'm open to suggestions:

Here's the basic way the application works.   main index renders, javascript
runs to create an iframe, and set the src='phpfile.php' that runs in a
continuous loop.  it connects to the server, and then listens for output.

Disconnecting from the server isn't an option at all, or else the
application will not function properly.  It needs to have the constant
"stream" to the server.

Is there a better solution for this?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.


Re: [PHP] output buffer with Chrome issue.

2009-05-01 Thread Robert Cummings
On Fri, 2009-05-01 at 10:34 -0400, Dan Joseph wrote:
>
> Ajax unfortunately isn't an option in this particular case.

Why? Maybe you're thinking about it wrong.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] output buffer with Chrome issue.

2009-05-01 Thread Dan Joseph
On Fri, May 1, 2009 at 10:29 AM, Robert Cummings wrote:

>
> Have you tried a bigger pad? Try... oh I dunno... 40096. if that works
> then you can chop back until you find the threshold. Seems to be though
> that it might be better done as AJAX.
>
>
Hi,

I tried that, didn't work at all even up to 144096 on the pad, but no dice.
Ajax unfortunately isn't an option in this particular case.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.


Re: [PHP] output buffer with Chrome issue.

2009-05-01 Thread Robert Cummings
On Fri, 2009-05-01 at 10:24 -0400, Dan Joseph wrote:
> Hi Everyone,
> 
> I'm trying to get Chrome to output html information as it comes thru.  We
> have an iframe running a php script, and when the php script receives
> information, it outputs it.  FF, IE, and Safari all work just fine, displays
> the info as it comes in.  However, Chrome is not.  It will only display the
> information after the php script stops executing.
> 
> I am outputting this after every echo:
> 
> echo str_pad( "", 4096 ) . "\n";
> 
> flush();
> ob_flush();
> 
> ob_implicit_flush();
> 
> Has anyone else had this issue?  Anyone know how to fix it?

Have you tried a bigger pad? Try... oh I dunno... 40096. if that works
then you can chop back until you find the threshold. Seems to be though
that it might be better done as AJAX.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] output buffer with Chrome issue.

2009-05-01 Thread Dan Joseph
Hi Everyone,

I'm trying to get Chrome to output html information as it comes thru.  We
have an iframe running a php script, and when the php script receives
information, it outputs it.  FF, IE, and Safari all work just fine, displays
the info as it comes in.  However, Chrome is not.  It will only display the
information after the php script stops executing.

I am outputting this after every echo:

echo str_pad( "", 4096 ) . "\n";

flush();
ob_flush();

ob_implicit_flush();

Has anyone else had this issue?  Anyone know how to fix it?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.


Re: [PHP] how to enable ttf support in php 5.2.9

2009-05-01 Thread Michael A. Peters

PJ wrote:

Is there a module to be activated or what has to be installed to have
ttf support in php?


addendum to my earlier reply -

make sure your gd library is built with freetype as well, and make sure 
it is freetype 2.


I'm guessing your gd library already is, but ...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] how to enable ttf support in php 5.2.9

2009-05-01 Thread Michael A. Peters

PJ wrote:

Is there a module to be activated or what has to be installed to have
ttf support in php?


on unix systems, ttf support should be there with freetype - which 
supports both ttf and postscript type 1 fonts (and probably also 
supports .otf though I haven't tried)


enable freetype and use the php freetype functions.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Two very useful PHP functions

2009-05-01 Thread Andrew Ballard
On Fri, May 1, 2009 at 4:05 AM, Darren  wrote:
> This was discussed for PHP6, but eventually decided not to have such a
> function. Instead, we now have the following:    $var = $_GET['var'] ?: 5;
>
> Taken from http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html
>
> 'you'd be able to do something like this: "$foo = $_GET['foo'] ?: 42;" (i.e.
> if foo is true, $foo will equal 42).'
>
>

I don't like that syntax at all. You would have to scrutinize code
even more to determine whether a statement like this was intentional
or a botched ternary operator. I'm not sure there is a need for a
function like ifset/ifsetor, but I'd MUCH rather have a clear function
name that could easily be found in the manual than mangling the
ternary operator.

Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Upload file name not file

2009-05-01 Thread MikeP
I'm not trying to get the path, just the filename and size, I know how to 
get these, but that would include the file using $_Files, but I dont want to 
upload anything just use the filename and size.(without the path) to insert 
into a DB.
"Simon"  wrote in message 
news:5f14cf5e0905010629s2253cc3bk2a83dbf8b754c...@mail.gmail.com...
>> Id like to use the popup file system box(> type="file"
>> />) to choose a file name , but I only want to upload the filename , not 
>> the
>> file. Can I do that?
>
> You're not supposed to have any access to the remote visitor's
> computer, and the path to the file being uploaded could contain
> sensitive information (ie. like username of windows user).  There are
> ways to get the information, even to read information on disk without
> the use of a file upload form.  But they are/will be considered like
> security threats and are/will be closed down.
>
> IMO, whatever way you find to get this information is meant 1) not to
> be portable accross different browsers and 2) to stop working
> eventually.  (Of course unless you ask the user to explicitly type the
> path in a text input)
>
> What do you need this for? 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] how to enable ttf support in php 5.2.9

2009-05-01 Thread PJ
Is there a module to be activated or what has to be installed to have
ttf support in php?
My port on FreeBSD does not have an option for ttf support under make
config .
I'm trying to learn & understand the following:
In file1 : 
In file2 (button.php)- originally php3 :

ONLY the above & nothing else. So far, all I get is a small blue square.
Replacing the $text with the text just gives a rectangle a bit wider.
gd is installed but ttf is not, so I figure that is the culprit.
But how is the text supposed to be assigned to $text from file1?
TIA

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Upload file name not file

2009-05-01 Thread Simon
> Id like to use the popup file system box( />) to choose a file name , but I only want to upload the filename , not the
> file. Can I do that?

You're not supposed to have any access to the remote visitor's
computer, and the path to the file being uploaded could contain
sensitive information (ie. like username of windows user).  There are
ways to get the information, even to read information on disk without
the use of a file upload form.  But they are/will be considered like
security threats and are/will be closed down.

IMO, whatever way you find to get this information is meant 1) not to
be portable accross different browsers and 2) to stop working
eventually.  (Of course unless you ask the user to explicitly type the
path in a text input)

What do you need this for?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] object literals

2009-05-01 Thread Richard Heyes
Hi,

> You could use JSON,
>
> $foo = json_decode('{"a":1,"b":3}');
>
> but I guess that's not much better than Richard's suggestion.

Didn't think of that (well... it's new). That's actually much better I
think, since you get the added boon of ease of portability to JS (if
that's even a factor).

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Upload file name not file

2009-05-01 Thread MikeP
Hello,
Id like to use the popup file system box() to choose a file name , but I only want to upload the filename , not the 
file. Can I do that?
Thanks
Mike 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ImageMagick

2009-05-01 Thread Kevin Waterson
This one time, at band camp, Michael A. Peters wrote:
> Here's the scenario -
> 
> Website has some demonstrative images.
> 
> I create these images with the gimp - starting with a jpeg, adding a few 
> text layers and straight lines.
> 
> I then save as xcf in case I ever need to edit.
> 
> Then I export to jpeg, resize for thumb and export to jpeg again.


http://phpro.org/tutorials/Imagick.html

Kevin
http://phpro.org



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] object literals

2009-05-01 Thread Peter Ford
Richard Heyes wrote:
> Hi,
> 
>>$x = (object) array('a'=>1, 'b'=>3, ...);
>>
>> which works but isn't very lovely. it's neater in, for example, javascript.
> 
> Well, you could wrap it up in a function to make it a bit lovelier. Eg:
> 
> $foo = createObject(array('key' => 'value'));
> 
> It's not great, but PHP doesn't have a object literal syntax AFAIK.
> 
You could use JSON,

$foo = json_decode('{"a":1,"b":3}');

but I guess that's not much better than Richard's suggestion.

-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] object literals

2009-05-01 Thread Richard Heyes
Hi,

>    $x = (object) array('a'=>1, 'b'=>3, ...);
>
> which works but isn't very lovely. it's neater in, for example, javascript.

Well, you could wrap it up in a function to make it a bit lovelier. Eg:

$foo = createObject(array('key' => 'value'));

It's not great, but PHP doesn't have a object literal syntax AFAIK.

-- 
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Two very useful PHP functions

2009-05-01 Thread Darren
This was discussed for PHP6, but eventually decided not to have such a
function. Instead, we now have the following:$var = $_GET['var'] ?: 5;

Taken from http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html

'you'd be able to do something like this: "$foo = $_GET['foo'] ?: 42;" (i.e.
if foo is true, $foo will equal 42).'


2009/5/1 Raymond Irving 

>
> Hi Colin and Daniel,
>
> Thanks for the feedback.
>
> I know that this functionality can be added to a framework or a stand alone
> function but I'm assuming that we would not get the same performance:
>
> Case 1
> ---
> $c = isset($a) ? $a : '';
> // total time = overhead  of isset() + overhead of ?:
>
> Case 2
> ---
> $c = myWrapper($a,$b)
> // total time = overhead of myWrapper() + overhead of isset() + overhead of
> ?:
>
> Case 3
> ---
> $c = ifset($a,$b)
> // total time = overhead of ifset()
>
>
>
> Best regards
>
> __
> Raymond Irving
>
> --- On Thu, 4/30/09, Daniel Brown  wrote:
>
> > From: Daniel Brown 
> > Subject: Re: [PHP] Two very useful PHP functions
> > To: "Raymond Irving" 
> > Cc: php-general@lists.php.net
> > Date: Thursday, April 30, 2009, 11:37 AM
> > On Wed, Apr 29, 2009 at 22:32,
> > Raymond Irving 
> > wrote:
> > >
> > > What do you think? Can they make it into 5.3?
> >
> > Not when doing the ternary operator that you
> > even displayed
> > yourself takes up less code and time than a core function
> > would.  It's
> > a good idea, but better handled on the frontend of
> > things.  You may
> > want to consider contributing that to a framework, which is
> > where it
> > would be more appropriate.
> >
> > --
> > 
> > daniel.br...@parasane.net
> > || danbr...@php.net
> > http://www.parasane.net/ || http://www.pilotpig.net/
> > 50% Off All Shared Hosting Plans at PilotPig: Use Coupon
> > DOW1
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] ImageMagick

2009-05-01 Thread Michael A. Peters

Ashley Sheridan wrote:




Do the text layers have to go beneath something on the original xcf, or
have special effects applied to them? If not, you can add t existing
images with GD, by using a source image, adding text layers, etc, and
then exporting it as a new graphic.


Yeah - I know I can do text with gd, I already do for some things.
The issue is that the placement of the text and the lines is custom per 
image, so it would require php coding each instance.


Some examples -

http://i142.photobucket.com/albums/r103/FunkyRes/8md.jpg
http://i142.photobucket.com/albums/r103/FunkyRes/telegans_shields02.jpg

Can be done with gd but it's a lot easier to add the text layers with a 
gui image editor - unless gimp has a php-gd export function that could 
write the code for me (that would be cool)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php