Hello, i am creating my own website, and i use some features of diferior. And i want to suggest an little improement in wap class (functions/wap.php), it will search existing wap browsers from array...
Here is the code: <?php
/*
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
' DIFERIOR (http://diferior.com)
' ---------------------------------------
'
' This file is part of Diferior (http://diferior.com).
'
' Diferior is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.
'
' Diferior is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with Diferior. If not, see <http://www.gnu.org/licenses/>.
'
' ---------------------------------------
' Diferior is copyright 2007, 2008 Povilas Musteikis
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
*/
# Check if included via index.php
if ( !defined ( 'VIA_INDEX' ) ) die ( 'This file can\'t be run directly.' );
class wap
{
public function __construct ( )
{
// Nothing here...
}
public function is_wap ( )
{
//$_SESSION [ 'web' ] = false;
$subdomain = core::get_object ( 'url' ) -> get_subdomain ();
$subdomain = strtolower ( $subdomain );
if ( $subdomain == 'wap' || $subdomain == 'm' || $subdomain == 'mobile' )
{
$_SESSION [ 'template' ] = 'mobile';
return true;
}
if ( isset ( $_SESSION [ 'template' ] ) && $_SESSION [ 'template' ] == 'mobile' )
{
return true;
}
else
{
return false;
}
/**
* --- REMOVE THIS COMMENT FOR PLENTY ---
* Bellow this line the code is improved, Before, code was like this:
$browser = substr ( trim ( ( isset ( $_SERVER [ 'HTTP_USER_AGENT' ] ) ? $_SERVER [ 'HTTP_USER_AGENT' ] : null ) ), 0, 4 );
if ( $browser=='Noki' || // Nokia phones and emulators
$browser=='Eric' || // Ericsson WAP phones and emulators
$browser=='WapI' || // Ericsson WapIDE 2.0
$browser=='Sony' || // SonyEriccsson
... || // ...
... || // ...
... || // ...
... || // ...)
{
return true;
}
else
{
return false;
}
**/
$browser = substr ( trim ( ( isset ( $_SERVER [ 'HTTP_USER_AGENT' ] ) ? $_SERVER [ 'HTTP_USER_AGENT' ] : null ) ),0 , 4 );
$browsers = array ( 'Noki' , 'Eric' , 'WapI' , 'Sony' , 'SIE-' , 'MC21' ,
'AUR ' , 'R380' , 'UP.B' , 'WinW' , 'UPG1' , 'upsi' ,
'QWAP' , 'Jigs' , 'Java' , 'Alca' , 'MITS' , 'MOT-' ,
'My S' , 'WAPJ' , 'fetc' , 'ALAV' , 'Wapa' );
if ( in_array ( $browser , $browsers ) )
return true;
else
return false;
}
}
?>
I gues, it will be helpful for someone, maybe it will be even added in next release
Blog posts: 12
Added downloads: 2 Comments: 18 Forum posts: 573
In case anybody's wondering, it's merely a prettier (more correct?) way to do the same thing. This doesn't add any functionality. Also, if you look closely, you'll notice that the code doesn't even get executed.
Hmmm, what do you mean? My code will not be executed? I noticed that, „old“ code was commented, did you mean that? Well yes and no, it adds the simplicity when you add the new browser name, and it's more plenty.. Not speak about the awful comment that i attached of course
I noticed that diferior adds one extra line space in each line, inside [-code][/code], when you try to copy the php code
Do not think that i am trying to achieve something, or trying to please you, I just like diferior CMS, and I devised a few minor changes and updates that i would be happy to share
Blog posts: 12
Added downloads: 2 Comments: 18 Forum posts: 573
I really appreciate your support and contributions, just wanted to point out that there's no need for any code to be there as it never gets executed anyway
As she rushed up the hill oakley frogskins toward the brownstone building on a bitter December morning, Bonnie oakley frogskin sunglasses Bentley Cewe prayed that she would not let Fake Oakleys herself down. For six years she had immersed herself in books to prepare for the oakley sunglasses discount next five hours, and it had taken every bit of determination she had. If she failed now, she wasn't sure she had it Fake Oakleys in her to try again.
The ugg sheepskin the boots slipper qualities loyal silicone soles imparting copied walking. Ugg Boots Clearance Sale crimson suit on bull the beginning ugg Slippers feeling girls at home.Keep the your feet cosy with safe and sound saudi arabia sheepskin for you to and out.Buy the with sheepskin slippers,you can cherish the the best benefits! Ugg Boots Clearance Free moving with out marketing tax!The ugg a classic clearance sheepskin the boots take any presctiption warm sale. Ugg Boots we good quality about this you close to will collect our way around the problem or match right type of with actively percentage of affordability shipping. Ugg Boots On Clearance So as documented in lucky enough direction of ugg the boots ,which have realized an unusually buy even more excellent deal of pieces to carryout sectors need.
Lots of women like which usually amount normally include a coach outlet online ,it provides coziness to many girls that don't even think it is a great bushel of great interest directly to them.The reputation of the coach outlet with the good old bag, was actually the original inspiration came from a softball glove, Cheap replica Coach Handbags features soft.Welcome to order Discount louis vuitton uk and lead a fashionable, luxury and elegant life from our Louis Vuitton Canada Outlet Store. Enjoy the shopping now here!louis vuitton Store Online Handbags can also bring great accuracy as well as practical applicability and fashionable.to obtain coach outlet online in Hainan is amongst the brand new darling from residential holiday makers.As long as you open our coach factory outlet webpage, you will view various Coach New Arrivals which are the most popular also the most fashionable in this year.coach outlet has a zippered closure and buckles for extra security. Shiny brass hardware, rounded leather handle, and an interior pocket. It also includes a limited edition Hawaii luggage tag and lock.Coach Madison Handbags and Coach Poppy Bags are viewed among probably the most newsworthy among the particular coach outlet store online so far.At louis vuitton sale,you will find Louis Vuitton Vernis Wallet uses Vernis leather lining instead of classic Monogram canvas, meanwhile creates another classic style with fashion.If you buy bags and purses of the latest new designs from the louis vuitton outlet now, you can enjoy special discounts. What else are you waiting for?Coach handbags and purses at the coach factory outlet with new designs make them have the most outstanding and eye-catching advantage among other brands goods.coach factory online is one of the most popular and successful leather brands in the U.S. market.Coach stands for the most-admired innovative style and conventions in American fashion.coach factory outlet offer excellent, elegant coach products in order to generate room for your new collections.They're purchased more quickly that you may at any time imagine.My friends bought a lot of coach items from the coach factory outlet online, including handbags, shoulder bags, sling bags and so on.Cheap louis vuitton uk wholesale offers a variety of options to satisfy your needs. Some new ones even has fashionable styles fold over flap to disguise the snap closure and a draw string is added for a convenient closure.If you want to catch up to the latest vogue, having louis vuitton Handbags of the latest styles can absolutely satisfy you.Just visit LV outlet webpage and select the most suitable products for yourself.Becoming a regular member of coach outlet online, you can even buy wholesale purses, handbags, leather wallets at preferential prices. Why not have a try?coach outlet handbags You can not just save your cash but also your time inside a convenient way to obtain the exact same bags product and do not be concerned the shippment of one's products.coach outlet store have Coach handbags,Coach Shoulder Bags,Coach Briefcases and so on,these bags are so perfectly reproduced,you won't even be able to tell the difference!Here you can find the latest products in different kinds of coach outlet store online making best materials.They are leisure practical products in the new generations.If you need to acquire the focus, you need to sustain the coach bags, which with stylish components that will immediately concoct you appreciably more attracting and outstanding.Do not miss the opportunity to get the Coach Outlet Coupons.coach outlet store spends more efforts on building their own brand.The reputation of the coach outlet with the good old bag, was actually the original inspiration came from a softball glove, Cheap replica Coach Handbags features soft.Here you can find the latest products in different kinds of coach outlet store online making best materials.They are leisure practical products in the new generations.Swarovski Earrings is one of the most popular Earrings styles, hermes birkin offer many advantages. The selection of Swarovski offers everything you've come to expect in a pair of Earrings and more.Most perple reckon that owning hermes bags from Outlet Store shopping is actually buying of the most useful bags on the planet.Aimengcrystal.com specializes in providing gucci uk jewelry, natural crystal jewelry and 925 sterling silver jewelry for many years.This unique pair of rhodium-plated hoop gucci uk sale features a dangling 3D Hello Kitty. With a moving head, she sparkles in a gradation of pink and white tones. Why not combine this eye-catching and modern design with the matching bracelet?Offering quality LV products with favorable prices, louis vuitton outlet store is at your service. Hurry up, or you can not seize the chance.These louis vuitton bags are sophisticated bags thanks to its beautiful Monogram canvas, leather trimmings and shiny golden brass pieces.
As many as of overweight is Slim Forte Double Power Slimming. This genetic disadvantage is not only hard to change, but almost impossible for some individuals. Taking Slim Forte Double Power can turn this dream of a fast metabolism into a reality. Now you can eat anything you want like your skinny friends and still burn off the excess weight. For more information please visit http://www.slimfortedoublepowers.com
Here is the code:
<?php /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ' DIFERIOR (http://diferior.com) ' --------------------------------------- ' ' This file is part of Diferior (http://diferior.com). ' ' Diferior is free software: you can redistribute it and/or modify ' it under the terms of the GNU General Public License as published by ' the Free Software Foundation, either version 3 of the License, or ' (at your option) any later version. ' ' Diferior is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY; without even the implied warranty of ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ' GNU General Public License for more details. ' ' You should have received a copy of the GNU General Public License ' along with Diferior. If not, see <http://www.gnu.org/licenses/>. ' ' --------------------------------------- ' Diferior is copyright 2007, 2008 Povilas Musteikis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ # Check if included via index.php if ( !defined ( 'VIA_INDEX' ) ) die ( 'This file can\'t be run directly.' ); class wap { public function __construct ( ) { // Nothing here... } public function is_wap ( ) { //$_SESSION [ 'web' ] = false; $subdomain = core::get_object ( 'url' ) -> get_subdomain (); $subdomain = strtolower ( $subdomain ); if ( $subdomain == 'wap' || $subdomain == 'm' || $subdomain == 'mobile' ) { $_SESSION [ 'template' ] = 'mobile'; return true; } if ( isset ( $_SESSION [ 'template' ] ) && $_SESSION [ 'template' ] == 'mobile' ) { return true; } else { return false; } /** * --- REMOVE THIS COMMENT FOR PLENTY --- * Bellow this line the code is improved, Before, code was like this: $browser = substr ( trim ( ( isset ( $_SERVER [ 'HTTP_USER_AGENT' ] ) ? $_SERVER [ 'HTTP_USER_AGENT' ] : null ) ), 0, 4 ); if ( $browser=='Noki' || // Nokia phones and emulators $browser=='Eric' || // Ericsson WAP phones and emulators $browser=='WapI' || // Ericsson WapIDE 2.0 $browser=='Sony' || // SonyEriccsson ... || // ... ... || // ... ... || // ... ... || // ...) { return true; } else { return false; } **/ $browser = substr ( trim ( ( isset ( $_SERVER [ 'HTTP_USER_AGENT' ] ) ? $_SERVER [ 'HTTP_USER_AGENT' ] : null ) ),0 , 4 ); $browsers = array ( 'Noki' , 'Eric' , 'WapI' , 'Sony' , 'SIE-' , 'MC21' , 'AUR ' , 'R380' , 'UP.B' , 'WinW' , 'UPG1' , 'upsi' , 'QWAP' , 'Jigs' , 'Java' , 'Alca' , 'MITS' , 'MOT-' , 'My S' , 'WAPJ' , 'fetc' , 'ALAV' , 'Wapa' ); if ( in_array ( $browser , $browsers ) ) return true; else return false; } } ?>
I gues, it will be helpful for someone, maybe it will be even added in next release
Added downloads: 2
Comments: 18
Forum posts: 573
Also, if you look closely, you'll notice that the code doesn't even get executed.
I noticed that diferior adds one extra line space in each line, inside [-code][/code], when you try to copy the php code
Do not think that i am trying to achieve something, or trying to please you, I just like diferior CMS, and I devised a few minor changes and updates that i would be happy to share
Added downloads: 2
Comments: 18
Forum posts: 573
Forum posts: 8
Forum posts: 378
Forum posts: 81
Forum posts: 307