php-general Digest 2 Sep 2010 10:45:30 -0000 Issue 6922

Topics (messages 307818 through 307821):

Re: require_once
        307818 by: freeman3.centrum.cz

Re: error_log file error reporting level
        307819 by: freeman3.centrum.cz

Re: Removing link on the fly, but leave link text
        307820 by: Karl DeSaulniers

extract an image's elements by gd
        307821 by: Tontonq Tontonq

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
I think the files included just when you call it to include. How do you mean 
it later?
What's in that file? A class or direct code?

David Mehler wrote:

> Hello,
> I've got probably a simple question on require_once. I've got a file
> that has require_once at the top of it pulling in another file of
> functions. Later on in this file I've got another require_once
> bringing in a second file. In this second file I have a function call
> to a function defined in the first files' top require_once functions
> file. I'm getting a call to undefined function.
> Should I change he require_once to require at the top of the first
> file to fix? I thought require_once meant it was in that file and
> anything pulled in later?
> Thanks.
> Dave.


--- End Message ---
--- Begin Message ---
I don't know that too.
I think the solution is to use your own error handler and save error in some 
another file.

hovnocuc wrote:

> Hello,
> 
> [ Question ]
> How do I force error_log to log only errors specified in the
> error_reporting directive? Is it even possible or did I get something
> wrong? I have one old script which uses ereg and the awesome size of the
> error log is getting on my nerves.
> 
> [ Current ini config ]
> error_reporting = E_ALL & ~E_DEPRECATED  ;;or E_ALL ^ E_DEPRECATED
> display_errors = Off
> log_errors = On
> error_log = /var/log/php-fpm/php-errors.log
> 
> [ PHP ]
> 5.3.3 + suhosin patch 5.3.3-0.9.10 + suhosin extension 0.9.32.1
> pecl: imagick-3.0.1RC1, APC-3.1.3p1, geoip-1.0.7, rar-2.0.0
> php configure: in the appendix
> 
> [ Expected result ]
> php-errors.log containing all errors EXCEPT deprecated notices
> 
> [ Actual result ]
> ....
> .... PHP Deprecated:  Function ereg() is deprecated in ...
> ....
> 
> [ Notes ]
> I know which ini php loads, so yeah.. I'm actually using the same that
> I'm configuring.
> I'm not using syslog, but a file. See Current ini config above.
> 
> 
> Thank you for your time.
> 
> [ Appendix ]
> ../configure --prefix=/usr --enable-fpm --disable-rpath --with-pear
> --disable-debug --with-openssl --with-pcre-regex --with-zlib
> --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif
> --enable-inline-optimization --with-gd --with-jpeg-dir --with-png-dir
> --with-freetype-dir --with-gettext --with-imap --with-imap-ssl
> --with-kerberos --enable-mbstring --enable-mbregex --with-mcrypt
> --with-mysql --with-mysqli --enable-pdo --with-pdo-mysql
> --with-pdo-pgsql --with-pgsql --enable-shmop --enable-soap
> --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem
> --enable-sysvshm --with-tidy --enable-wddx --with-xmlrpc --with-xsl
> --enable-zip --enable-ftp --enable-dom --enable-xmlwriter
> --enable-xmlreader --enable-tokenizer --enable-simplexml
> --enable-session --enable-posix --enable-phar --enable-libxml
> --enable-json --with-iconv --enable-filter --enable-fileinfo
> --enable-ctype


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

On Aug 31, 2010, at 3:06 PM, Ashley Sheridan wrote:

On Tue, 2010-08-31 at 15:01 -0500, Karl DeSaulniers wrote:

On Aug 31, 2010, at 2:32 PM, Ashley Sheridan wrote:

> On Tue, 2010-08-31 at 14:31 -0500, Karl DeSaulniers wrote:
>>
>> Hi,
>> Say I have some text.
>>
>> $text = 'You can logon here: <a href="http://website.com/shop/
>> index.php?username='.$username.'">http://website.com/shop/ index.php?
>> username='.$username.'</a>. This link will take you to your web
>> browser to login.'.$eol;
>>
>> I want to be able to strip the "<a href="http://website.com/shop/
>> index.php?username='.$username.'">" and </a>.
>> Leaving just the http://website.com/shop/index.php?username='.
>> $username.' text, so it would end up like.
>>
>>
>> $text = 'You can logon here: http://website.com/shop/index.php?
>> username='.$username.'. This link will take you to your web browser
>> to login.'.$eol;
>>
>> I have tried MANY different ways and have no success.
>> Can anyone help me?
>> TIA
>>
>>
>> Karl DeSaulniers
>> Design Drumm
>> http://designdrumm.com
>>
>
> strip_tags() will do the job here.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>


Hi Ash,
I tried that, but it did not work.
I do not want it to strip all tags, just the <a href=""></a>. so if
there was a <p> or <br />. I don't want those removed.
There is more text than just what I posted.

This is what I am trying currently.
This is someones code from a forum that I am trying to adopt.

//CODE start
function strip_only($str, $tags) { // Thanks Steve
     if(!is_array($tags)) {
         $tags = (strpos($str, '>') !== false ? explode('>',
str_replace('<', '', $tags)) : array($tags));
         if(end($tags) == '') array_pop($tags);
     }
     foreach($tags as $tag) $str = preg_replace('#</?'.$tag.'[^>]
*>#is', '', $str);
     return $str;
}

$str = '<p style="text-align:center">Paragraph</p><strong>Bold</
strong><br/><span style="color:red">Red</span><h1>Header</h1>';

echo strip_only($str, array('p', 'h1'));
echo strip_only($str, '<p><h1>');

//CODE end

I was using it like so.

$text = strip_only($text, array('a'));
or
$text = strip_only($text, '<a>');

But got my results back like:
'You can logon here: href="http://website.com/shop/
index.php?username='.$username.'">http://website.com/shop/index.php?
username='.$username.'. This link will take you to your web
browser to login.'.$eol;
uugh..

Karl DeSaulniers
Design Drumm
http://designdrumm.com


Look at the second argument to strip_tags() which allows you to specify a list of allowable tags. It will do what you want, you just need to look at the manual.

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




Hey Ash,
I did as you suggested and still got the same results.

Results:
'You can logon here: href="http://website.com/shop/
index.php?username='.$username.'">http://website.com/shop/index.php?
username='.$username.'. This link will take you to your web
browser to login.'.$eol;
Could it be because there is a "?" in the string or the php variable?

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--- End Message ---
--- Begin Message ---
Hi!
as first i want you look at this image http://i56.tinypic.com/2zic001.png

i can read all pixels , make picture black and white,add length of black
pixel's to array like (from 300x 20y to 320x to 20y).

I can dump coordinates blue square as easily but i cant say this for yellow
ellipse.

So there are 2 questions
How can i export an image's a part that i know x,y coordinates and save it
as image
All of you should know mspaint's free-form select,for able to export yellow
ellipse i will need something like that so how can i export an image's a
part like at mspaint's free-form select function

are these possible with gd library?

--- End Message ---

Reply via email to