| Author |
Message |
meotoo
Newbie


Joined: Aug 04, 2009
Posts: 2
|
Posted:
Mon Sep 14, 2009 9:54 am |
|
Hello Montego, and all.
We at www.meotoo.com started using ShortLinks and i just would like to express my gratitude to you (and previous involved people) for such a great add-on. Thank You.
As some reward.. here you have a fixed tnsl_fCleanLinks() function which should work fast(?)/sweet or at least bugfree, cause i've noticed your original function tries to transform the whole page contents (while only links should be needed) causing unpredictable errors from embed javascript code.
| Code: |
function fCleanLinks_Stub($link,$q)
{ // MeoToo way ;)
if(strpos( $link, '&') !== false)
$link = str_replace(array('','&','&','<<#>>'),array('<<#>>','&','&',''),$link);
return $q.$link.$q;
}
function tnsl_fCleanLinks(&$getNextGen) {
// Function Fixed/Improved by MeoToo Development - http://www.meotoo.com/ 20090913
$getNextGen = preg_replace('#\s+(src|href|action)\=([\'"]?)([^\s\\2]+)\\2#ei','" $1=".fCleanLinks_Stub("$3","$2")',$getNextGen);
// montego - following code is required to allow the new RNYA AJAX validations to work properly
$getNextGen = preg_replace('/rnxhr.php\?name=Your_Account&file/', 'rnxhr.php\?name=Your_Account&file', $getNextGen );
return;
}
|
We did as well a few number of cleanups, if you want i could send you the whole shortlinks.php file.
Regarding the donation you request by using this addon, what about if we give you a discount with some of our products? or if you like FlashGames we could give you a GamesPack for free
Best Regards. |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1281
|
Posted:
Mon Sep 14, 2009 5:31 pm |
|
Meotoo,
Very much appreciate your post and thanks. No worries on the donation since you are giving back to the community in making ShortLinks better. If you do not mind, I would like to see the entire set of changes side-by-side, so, yes, I would love to see the completed PHP script.
Please send to montego || at }} montegoscripts {{ dot || com
Thank you! |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
meotoo
Newbie


Joined: Aug 04, 2009
Posts: 2
|
Posted:
Wed Sep 16, 2009 3:58 pm |
|
Sent.
(Sorry for the delay ;) |
| |
|
|
 |
Lucifix
Newbie


Joined: Feb 26, 2008
Posts: 5
|
Posted:
Fri May 21, 2010 12:12 pm |
|
I have one question, on my site im using The PHP thumbnail generator
http://phpthumb.sourceforge.net/
I've alot of problems with replacing & with & because after that I get a lot of errors with my apache.
This is how code should look like:
| Code: |
| phpThumb.php?src=pathtoimage&w=90&h=90&zc=1&q=100 |
but with replacing & with & i get this:
| Code: |
| phpThumb.php?src=pathtoimage&w=90&h=90&zc=1&q=100 |
Image show up, but i get too many errors in apache and the server will eventual shut down.
Does anyone have any solution for that not to replace all &?
PS: it's pretty urgent, because I need to restart server even more then twice a day and my vacation is coming very soon (who will restart my server then?)  |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1281
|
Posted:
Sat May 22, 2010 10:40 am |
|
I don't understand what errors you would be getting in Apache. A URL with & in it is compliant to W3C standards for URLs. Would you mind posting for me a few samples of these errors (remove path specifics or PM me if you would rather).
Also, it would help if I could see the page where you have such links. I'd like to see where they are located and the resultant HTML. Again, if you would rather post the URL to your site inside a PM, that is fine.
My first thought was to "tap" these links like everything else but the Apache error thing is really bugging me. I need to understand that better first before I can recommend a path to take. |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Lucifix
Newbie


Joined: Feb 26, 2008
Posts: 5
|
Posted:
Thu May 27, 2010 1:35 am |
|
This is from error log:
getimagesize(PATHTOMYWEBSITE/phpThumb/phpThumb.php?src=IMAGENAME.jpg&w=250&h=142&zc=1&q=90) [<a href='function.getimagesize'>function.getimagesize</a>]: could not make seekable
Then my apache crash with this error:
[notice] child pid xyz exit signal Segmentation fault (11)
xyz = some numbers
My website: http://www.slo-foto.net/
Now I have installed @meotoo links, but I want to use shortlinks only for "a href" link, but not for images (<img src..>) or javascript (<script src="...">) |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1281
|
Posted:
Thu May 27, 2010 3:53 pm |
|
Since you are using meotoo's code, have you tried changing this:
to just:
? |
| |
|
|
 |
Lucifix
Newbie


Joined: Feb 26, 2008
Posts: 5
|
Posted:
Fri May 28, 2010 8:09 am |
|
I did that but look what happened to javascript:
| Code: |
| <a href="javascript:replyb(\'Lucifix\', '114202');"> |
It should be:
| Code: |
| <a href="javascript:replyb('Lucifix', '114202');"> |
|
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1281
|
Posted:
Sat May 29, 2010 10:53 am |
|
Are you sure that ShortLinks is doing that substitution? Try turning ShortLinks off and checking that again. |
| |
|
|
 |
Lucifix
Newbie


Joined: Feb 26, 2008
Posts: 5
|
Posted:
Tue Jun 29, 2010 7:05 am |
|
| montego wrote: |
| Are you sure that ShortLinks is doing that substitution? Try turning ShortLinks off and checking that again. |
Sorry for my delay answer, yes I turned ShortLinks off and it's working normaly.
This is how my code looks like:
| Code: |
function tnsl_fCleanLinks(&$getNextGen) {
// Function Fixed/Improved by MeoToo Development - http://www.meotoo.com/ 20090913
$getNextGen = preg_replace('#\s+(href|action)\=([\'"]?)([^\s\\2]+)\\2#ei','" $1=".fCleanLinks_Stub("$3","$2")',$getNextGen);
// montego - following code is required to allow the new RNYA AJAX validations to work properly
$getNextGen = preg_replace('/rnxhr.php\?name=Your_Account&file/', 'rnxhr.php\?name=Your_Account&file', $getNextGen );
return;
} |
|
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1281
|
Posted:
Sun Jul 04, 2010 3:02 pm |
|
The code from Meotoo is not a part of ShortLinks. Please try me base code, as provided, and see if that works. |
| |
|
|
 |
Palbin
Newbie


Joined: Nov 26, 2007
Posts: 22
|
Posted:
Sun Mar 27, 2011 12:55 pm |
|
I find this to be a slightly better variation:
| Code: |
function fCleanLinks_Stub($link) {
if(strpos( $link, '&') !== false) {
$link = str_replace(array('','&','&','<<#>>'), array('<<#>>','&','&',''), $link);
}
return $link;
}
function tnsl_fCleanLinks(&$getNextGen) {
$getNextGen = preg_replace('#(href\s*=\s*[\'"]?)([a-zA-Z0-9/&;:=\?\._-]*)(["\'])#eiu', '"$1" . fCleanLinks_Stub("$2") . "$3"', $getNextGen);
return;
}
|
I removed the reference to "src" and "action" because I do not think they apply here as I do not see why they should the shortened. |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1281
|
Posted:
Sun Mar 27, 2011 1:01 pm |
|
Just so you know, I'm not endorsing this... yet. I need the time to review. Just haven't yet.. sorry. Life is busy atm. I hope to get to it tomorrow as I have the day off just for me.  |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Palbin
Newbie


Joined: Nov 26, 2007
Posts: 22
|
Posted:
Sun Mar 27, 2011 3:49 pm |
|
Just offering my opinion  |
| |
|
|
 |
Killing-Hours
Newbie


Joined: Mar 24, 2011
Posts: 10
|
Posted:
Mon Mar 28, 2011 11:09 am |
|
Palbin-
I wish I were advanced enough to understand how your code works and how I could help test this further... but I can't.
I did test it with my json/ajax test module and it seemed to work flawlessly. That's not to say it won't break other things elsewhere... but I really appreciate you. Thanks!
@Montego-
I'll wait till you endorse this so I can feel safe with it.
Really appreciate both of you and your work. |
| |
|
|
 |
|
|