php-general Digest 22 Sep 2009 13:45:13 -0000 Issue 6352

Topics (messages 298248 through 298256):

Re: Extract links from strings
        298248 by: Jim Lucas
        298249 by: Jim Lucas

Re: Validation XHTML code and repairing broken one
        298250 by: Manuel Lemos
        298255 by: Michael A. Peters

using a USB device (flash) in the Virtualbox
        298251 by: chamba kasonde
        298253 by: Ashley Sheridan
        298256 by: Robert Cummings

Question: Wai-aria?
        298252 by: Parham Doustdar
        298254 by: Fernando Castillo Aparicio

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Jônatas Zechim wrote:
> Hi there, i've the following strings:
> 
> $string1 = 'Lorem ipsum dolor http://site.com sit amet';
> $string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
> $string3 = 'Lorem ipsum dolor http://www.site.net sit amet';
> 
> How can I extract the URL from these strings?
> They can be [http:// + url] or [www. + url].
> 
> Zechim
> 
> 

Something like this should work for you.

<plaintext><?php

$urls[] = 'Lorem ipsum dolor http://site.com sit amet';
$urls[] = 'Lorem ipsum dolor https://www.site.com/ sit amet';
$urls[] = 'Lorem ipsum dolor www.site1.net sit amet';
$urls[] = 'Lorem ipsum dolor www site2.net sit amet';

foreach ( $urls AS $url ) {
        if ( preg_match('%((https?://|www\.)[^\s]+)%', $url, $m) ) {
                print_r($m);
        }
}

?>


--- End Message ---
--- Begin Message ---
Jim Lucas wrote:
> Jônatas Zechim wrote:
>> Hi there, i've the following strings:
>>
>> $string1 = 'Lorem ipsum dolor http://site.com sit amet';
>> $string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
>> $string3 = 'Lorem ipsum dolor http://www.site.net sit amet';
>>
>> How can I extract the URL from these strings?
>> They can be [http:// + url] or [www. + url].
>>
>> Zechim
>>
>>
> 
> Something like this should work for you.
> 
> <plaintext><?php
> 
> $urls[] = 'Lorem ipsum dolor http://site.com sit amet';
> $urls[] = 'Lorem ipsum dolor https://www.site.com/ sit amet';
> $urls[] = 'Lorem ipsum dolor www.site1.net sit amet';
> $urls[] = 'Lorem ipsum dolor www site2.net sit amet';
> 
> foreach ( $urls AS $url ) {
>       if ( preg_match('%((https?://|www\.)[^\s]+)%', $url, $m) ) {
>               print_r($m);
>       }
> }
> 
> ?>
> 

Actually, try this.  It seems to work a little better.

<plaintext><?php

$urls[] = 'Lorem ipsum dolor http://site.com sit amet';
$urls[] = 'Lorem ipsum dolor https://www.site.com/ or http://www.site2.com/';
$urls[] = 'Lorem ipsum dolor www.site1.net sit amet';
$urls[] = 'Lorem ipsum dolor www site2.net sit amet';

foreach ( $urls AS $url ) {
        if ( preg_match_all(    '%(https?://[^\s]+|www\.[^\s]+)%',
                                $url,
                                $m,
                                (PREG_SET_ORDER ^ PREG_OFFSET_CAPTURE)
        ) ) {
                print_r($m);
        }
}

?>


--- End Message ---
--- Begin Message ---
Hello,

on 09/17/2009 06:33 AM Dušan Novaković said the following:
> I have few questions about validation XHTML and repairing if it's
> broken. The problem is that I have some, for example HTML code (simple
> web page) and want to load that page to DOMDocument and than make
> something of it. That part works perfect, but if there is unclosed tag
> or something like that when I try to load that page I get an error
> because now that code is not valid. So my question would be, is there
> some way that I could build some script in php that would run thought
> that page and check if it's valid or not, and if it's not than try to
> repair it. Something that you have in all tools, for example Eclipse,
> NetBeans, etc. If anyone have any idea, please help me, because I'm
> stuck in here :-(

You may want to try this HTML parser package. It is tolerating to
malformed HTML documents. It returns a stream of document elements, such
as tags, data, character entities, etc.. that you can pass back to the
class and regenerate a well-formed document. It comes even with filter
class that validates the document against a DTD and adds missing closed
tags and such.

http://www.phpclasses.org/secure-html-filter

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--- End Message ---
--- Begin Message ---
Al wrote:



Hello,

I have few questions about validation XHTML and repairing if it's
broken. The problem is that I have some, for example HTML code (simple
web page) and want to load that page to DOMDocument and than make
something of it. That part works perfect, but if there is unclosed tag
or something like that when I try to load that page I get an error
because now that code is not valid. So my question would be, is there
some way that I could build some script in php that would run thought
that page and check if it's valid or not, and if it's not than try to
repair it. Something that you have in all tools, for example Eclipse,
NetBeans, etc. If anyone have any idea, please help me, because I'm
stuck in here :-(

Regards,
Dusan


I spent some time on this issue because I have several applications where users enter text that must be later displayed as valid XHTML on a webpage.

I've found Tidy [a PHP extension] is the best and simplest solution.

I agree - you can pass it through tidy and then import it into a DOM or whatever it is you need x(ht)ml for.

It works well for me.

You can also use HTML Purifier to remove tags you do not want to allow, and HTML Purifier can pass it through tidy for you.
--- End Message ---
--- Begin Message ---
Hi!
I am a new user of this feature and tool and would like to transfer data and 
info to and from Windows Xp in the Virtualbox running on a Linux Ubuntu 
platform.
My first version of Virtualbox was 2._ _ _ which said it did not support that 
feature.
Therefore, I upgraded to 3._ _ _ which supports it but the flash does not show 
nor appear in the XP window.
How do I get to use my flash on both parallel running systems?


      

--- End Message ---
--- Begin Message ---
On Mon, 2009-09-21 at 22:50 -0700, chamba kasonde wrote:
> Hi!
> I am a new user of this feature and tool and would like to transfer data and 
> info to and from Windows Xp in the Virtualbox running on a Linux Ubuntu 
> platform.
> My first version of Virtualbox was 2._ _ _ which said it did not support that 
> feature.
> Therefore, I upgraded to 3._ _ _ which supports it but the flash does not 
> show nor appear in the XP window.
> How do I get to use my flash on both parallel running systems?
> 
> 
>       
Totally the wrong list for that sort of question. It's not even remotely
related to PHP...

Thanks,
Ash
http://www.ashleysheridan.co.uk




--- End Message ---
--- Begin Message ---


Ashley Sheridan wrote:
On Mon, 2009-09-21 at 22:50 -0700, chamba kasonde wrote:
Hi!
I am a new user of this feature and tool and would like to transfer data and 
info to and from Windows Xp in the Virtualbox running on a Linux Ubuntu 
platform.
My first version of Virtualbox was 2._ _ _ which said it did not support that 
feature.
Therefore, I upgraded to 3._ _ _ which supports it but the flash does not show 
nor appear in the XP window.
How do I get to use my flash on both parallel running systems?


Totally the wrong list for that sort of question. It's not even remotely
related to PHP...

You want to skip the OSE version and get the version that has USB support built in. The open source edition does not have USB support due to licensing (or somesuch) issues.

Alternatively you can set up a shared folder so that a folder on your Ubuntu host can be mapped to a drive in the Windows XP guest. The latter is more convenient for sharing your uh.. PHP data amongst multiple guests.

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

--- End Message ---
--- Begin Message ---
Hello there,
I have asked on the mailing lists that have blind users and no one seems to 
know about this technology (that is ironically created to help us blind folks). 
I was wondering if anyone here has the experience of implementing Wai-aria. 
Since my question is rather about Wai-aria than PHP and is off-topic, I'm first 
of all sorry to be posting it here (it is rather an act of desperation). 
Secondly, I ask people who have the time to help me to please contact me 
off-list at parham90 at gmail dot com.
Thanks.
-- 
---
Contact info:
Skype: parham-d
MSN: fire_lizard16 at hotmail dot com
GoogleTalk: [email protected]
Twitter: PD90
email: parham90 at GMail dot com

--- End Message ---
--- Begin Message ---
Ups! By mistake I didn't reply to all. Resending. Sorry.




________________________________
De: Parham Doustdar <[email protected]>
Para: [email protected]
Enviado: martes, 22 de septiembre, 2009 9:41:44
Asunto: [PHP] Question: Wai-aria?

Hello there,
I
have asked on the mailing lists that have blind users and no one seems
to know about this technology (that is ironically created to help us
blind folks). I was wondering if anyone here has the experience of
implementing Wai-aria. Since my question is rather about Wai-aria than
PHP and is off-topic, I'm first of all sorry to be posting it here (it
is rather an act of desperation). Secondly, I ask people who have the
time to help me to please contact me off-list at parham90 at gmail dot
com.
Thanks.
-- 
---
Contact info:
Skype: parham-d
MSN: fire_lizard16 at hotmail dot com
GoogleTalk: [email protected]
Twitter: PD90
email: parham90 at GMail dot com


Have you tried the contact section for WAI at w3.org? 
http://www.w3.org/WAI/contacts

They have a WAI Interest Group mailing list ([email protected], 
"suscribe" as subject), and I believe that would be the best place to look for 
help.

Good luck.



      

--- End Message ---

Reply via email to