2010/9/23 12:12:35
|
---|
![]() |
Imlinks performanceImlinks is a excelent module; a flagship.
But It seems has problems on performance; according to debug, take lot of time to load. My page has 6 categories and 65 links. Is it right? |
2010/9/23 13:02:47
|
---|
![]() |
Re: Imlinks performanceimLinks and modules based on this like MyTuve and Impression are slow indeed. Not sure what's causing this. The only thing I know that with the original WF-Links this was also the case.
On my website I have 192 Categories and 2547 Links. For this I have enabled GZip compression in the General Preferences of ICMS and set the cache of imLinks to 30 minutes. Edited by UnderDog on 2010/9/24 2:01:05
|
2010/9/23 14:44:34
|
---|
![]() |
Re: Imlinks performanceI had using 1.02 release; just updating five minutes ago to 1.04 RC1 and performance is really better. Run fast now. Thanks!! :)
Nice URL feature is fine; however, special characters got problem. In Spanish are letters as ñ, or ó, é, etc (I suppose in French or German too) Example: asociación become asociacin I know the news module by Underdog has a replace function; I do not know if it is useful for you. |
2010/9/23 15:27:45
|
---|
![]() |
Re: Imlinks performanceQuote:
You can enter a nice url manually in the submit form (admin) to avoid these special characters being stripped out. I use this option myself often. The reason these special characters are removed is that the nice url feature uses filter_var with the FILTER_SANITIZE_SPECIAL_CHARS filter. See functions.php. This filter allows ASCII only. At the moment it also allows symbols in the url what I don't like. I think I will make some kind of extra filter so these characters and symbols are replaced automatically. |
2010/9/23 17:33:51
|
---|
|
Re: Imlinks performanceHave you tried FILTER_SANITIZE_URL? There is also another flag you can use with FILTER_SANITIZE_SPECIAL_CHARS - FILTER_FLAG_ENCODE_HIGH
|
2010/9/24 0:51:07
|
---|
![]() |
Re: Imlinks performancefor future reference with icms 1.3 or newer.
checkout the function checkVar($var, $type, $opt1, $opt2) in libraries/icms/core/DataFilter.php you can use with $var = icms_core_DataFilter::checkVar(); here's the function comments doc:
/*
* Public Function checks Variables using specified filter type
*
* @TODO needs error trapping for debug if invalid types and options used!!
*
* @param string $data Data to be checked
* @param string $type Type of Filter To use for Validation
* Valid Filter Types:
* 'url' = Checks & validates URL
* 'email' = Checks & validates Email Addresses
* 'ip' = Checks & validates IP Addresses
* 'str' = Checks & Sanitizes String Values
* 'int' = Validates Integer Values
* 'html' = Validates HTML
*
* @param mixed $options1 Options to use with specified filter
* Valid Filter Options:
* URL:
* 'scheme' = URL must be an RFC compliant URL (like http://example)
* 'host' = URL must include host name (like http://www.example.com)
* 'path' = URL must have a path after the domain name (like www.example.com/example1/)
* 'query' = URL must have a query string (like "example.php?name=Vaughan&age=34")
* EMAIL:
* 'true' = Generate an email address that is protected from spammers
* 'false' = Generate an email address that is NOT protected from spammers
* IP:
* 'ipv4' = Requires the value to be a valid IPv4 IP (like 255.255.255.255)
* 'ipv6' = Requires the value to be a valid IPv6 IP (like 2001:0db8:85a3:08d3:1319:8a2e:0370:7334)
* 'rfc' = Requires the value to be a RFC specified private range IP (like 192.168.0.1)
* 'res' = Requires that the value is not within the reserved IP range. both IPV4 and IPV6 values
* STR:
* 'noencode' = Do NOT encode quotes
* 'strlow' = Strip characters with ASCII value below 32
* 'strhigh' = Strip characters with ASCII value above 127
* 'encodelow' = Encode characters with ASCII value below 32
* 'encodehigh' = Encode characters with ASCII value above 127
* 'encodeamp' = Encode the & character to &
* INT:
* minimum integer range value
*
* @param mixed $options2 Options to use with specified filter options1
* URL:
* 'true' = URLEncode the URL (ie. http://www.example > http%3A%2F%2Fwww.example)
* 'false' = Do Not URLEncode the URL
* EMAIL:
* 'true' = Reject if email is banned (Uses: $icmsConfigUser['bad_emails'])
* 'false' = Do Not use Email Blacklist
* IP:
* NOT USED!
* INT:
* maximum integer range value
*
* @return mixed
*/
|
_________________
Live as if you were to die tomorrow, Learn as if you were to live forever The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together! |
2010/9/24 2:15:37
|
---|
![]() |
Re: Imlinks performanceThe special characters as mentioned by debianus are not allowed in an URL.
imLinks uses 2 filters as follows: function iml_nicelink( $title, $niceurl ) {
$title = strtolower( filter_var( str_replace( ' ', '_', $title ), FILTER_SANITIZE_SPECIAL_CHARS ) );
$niceurl = strtolower( filter_var( str_replace( ' ', '_', $niceurl ), FILTER_SANITIZE_SPECIAL_CHARS ) );
if ( !$niceurl ) {
$nicelink = filter_var( $title, FILTER_SANITIZE_URL );
} else {
$nicelink = filter_var( $niceurl, FILTER_SANITIZE_URL );
}
return $nicelink;
} The FILTER_SANITIZE_URL filter removes all illegal URL characters from a string. This filter allows all letters, digits and $-_.+!*'(),{}|\\^~[]`"><#%;/?:@&= See here for example. But, if you like to have the special characters in the URL than modify the function as follows: function iml_nicelink( $title, $niceurl ) {
// $title = strtolower( filter_var( str_replace( ' ', '_', $title ), FILTER_SANITIZE_SPECIAL_CHARS ) );
// $niceurl = strtolower( filter_var( str_replace( ' ', '_', $niceurl ), FILTER_SANITIZE_SPECIAL_CHARS ) );
if ( !$niceurl ) {
$nicelink = $title; // filter_var( $title, FILTER_SANITIZE_URL );
} else {
$nicelink = $niceurl; // filter_var( $niceurl, FILTER_SANITIZE_URL );
}
return $nicelink;
} |
2010/9/24 8:51:34
|
---|
![]() |
Re: Imlinks performanceOf course, about new entries in imLinks and Impression there are the possibility for post one right title. The problems is about old entries.
Now special characters are deleted; however better would be change them. ó become o, etc. Example from news 1.70 (include/functions.php) function elimina_acentos
($string, $enc = 'UTF-8') { $acentos = array( 'A' => '/À|Á|Â|Ã|Ä|Å/', 'a' => '/à|á|â|ã|ä|å/', 'C' => '/Ç/', 'c' => '/ç/', 'E' => '/È|É|Ê|Ë/', 'e' => '/è|é|ê|ë/', 'I' => '/Ì|Í|Î|Ï/', 'i' => '/ì|í|î|ï/', 'N' => '/Ñ/', 'n' => '/ñ/', 'O' => '/Ò|Ó|Ô|Õ|Ö/', 'o' => '/ò|ó|ô|õ|ö/', 'U' => '/Ù|Ú|Û|Ü/', 'u' => '/ù|ú|û|ü/', 'Y' => '/Ý/', 'y' => '/ý|ÿ/', 'a.' => '/ª/', 'o.' => '/º/' ); $string = ereg_replace(" ", "-", preg_replace("/[][><}{)(:;,!?*%~^`'’@]/", "", $string)); return strtolower(preg_replace($acentos, array_keys($acentos), htmlentities($string, ENT_NOQUOTES, $enc))).'.html'; } |
2010/9/24 9:55:16
|
---|
|
Re: Imlinks performanceMy opinion is that we somehow should make a core function for this. All modules run into this problem.
News has its own function, ImLinks has its own function. We can better make 1 good function and implement it in both modules? |
2010/9/25 12:43:07
|
---|
![]() |
Re: Imlinks performance@debianus,
I've made an additional 'filter' that will turn the special characters in 'normal' characters. In function.php find the function iml_nicelink and replace it with this one: function iml_nicelink( $title, $niceurl ) {
$title = strtolower( filter_var( str_replace( ' ', '_', iml_charrepl( $title ) ), FILTER_SANITIZE_SPECIAL_CHARS ) );
$niceurl = strtolower( filter_var( str_replace( ' ', '_', $niceurl ), FILTER_SANITIZE_SPECIAL_CHARS ) );
if ( !$niceurl ) {
$nicelink = filter_var( $title, FILTER_SANITIZE_URL );
} else {
$nicelink = filter_var( $niceurl, FILTER_SANITIZE_URL );
}
return $nicelink;
} Than add the following function to functions.php: function iml_charrepl( $string ) {
$find = array( 'À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö' );
$repl = array( 'A','A','A','A','A','A','AE','C','E','E','E','E','I','I','I','I','D','N','O','O','O','O','O','a','a','a','a','a','a','ae','c','e','e','e','e','i','i','i','i','d','n','o','o','o','o','o','o' );
$text1 = str_replace( $find, $repl, $string );
$search = array (
'/\'/',
'/\"/',
'/\$/',
'/\£/',
'/\¥/',
'/\¢/',
'/\%/',
'/\@/',
'/\&/',
'/\#/',
'/\*/',
'/\~/',
'/\^/',
'/\`/',
'/\,/',
'/\./',
'/\(/',
'/\)/',
'/\[/',
'/\]/',
'/\{/',
'/\}/',
'/\|/',
'/\</',
'/\>/',
'/\?/',
'/\!/',
'/\//',
'/\;/',
'/\:/',
'/\©/',
'/\®/' );
$text = preg_replace( $search, '', $text1 );
return $text;
} This filter applies to the title of a link only and not an alternative title. |
2010/9/27 13:25:39
|
---|
![]() |
Re: Imlinks performanceThanks!! :thumbup:
|
2010/9/27 14:33:46
|
---|
![]() |
Re: Imlinks performanceYou might want to download the latest version of functions.php from the trunk here.
I've extended the lists of special characters yesterday. |
2010/9/28 0:47:40
|
---|
![]() |
Re: Imlinks performanceTested: it works smoothly :bravo:
|
2010/9/28 9:39:03
|
---|
![]() |
Re: Imlinks performanceI hope to publish RC-2 coming Thursday which also fixes the meta-tags (page title and meta-description).
|
2010/9/29 14:25:24
|
---|
![]() |
Re: Imlinks performance |