2010-10-30

F-engine – Framework PHP basado en CodeIgniter

F engine framework php F engine   Framework PHP basado en CodeIgniter
F-engine es framework para desarrollo de aplicaciones web basado en otro popular framework, CodeIgniter. Este proyecto tiene en mente acelerar el desarrollo web proveyendo una amplia gama de librerías y aplicaciones web para las tareas más frecuentes.
Entre las herramientas de desarrollo de F-engine figuran: un asistente para crear la estructura de una aplicación, un optimizador de archivos CSS, una herramienta para crear formularios desde una base datos, etc.
Al momento de escribir esta entrada no había tenido tiempo de experimentar con éste, pero si de ver el video (en español) que está en sus sitio web, el cual brinda una amplia visión de lo que este proyecto ofrece a los desarrolladores web. Sin dudas lo más destacable son las herramientas como la de creación de formularios desde una base datos.
F-engine esa disponible para descargar desde Google Code bajo una licencia BSD.

F-engine

Sitio: f-engine.net
Descargar: code.google.com/p/f-engine
Vía: email de Flnm

The Square Grid – Framework CSS

The Square Grid CSS Framework The Square Grid   Framework CSS
The Square Grid es un framework CSS pensado para diseñadores y desarrolladores web, que al igual que otros, su principal objetivo es disminuir sensiblemente el tiempo de desarrollo a la vez de permitir crear hermosos sitios web. Éste framework propone trabajar con 35 columnas de igual ancho.
Un simple vistazo a la página de The Square Grid parecería que carece o que la documentación es deficiente. Lo cierto es que es tan sencillo de entender que todo se encuentra en una sola página
Estuve probandodolo un rato y la verdad es que muy sencillo de aprender y ofrece muchas opciones muy interesantes como: los archivos CSS y HTML comentados, un archivo PDF para imprimir esquemas y plantillas para Photoshop, InDesign e  Illustrator. Además funciona en casi cualquier navegador moderno.
The Square Grid se puede descargar en un archivo ZIP que contiene los archivos del framework, los templates y el PDF.

The Square Grid

Sitio: thesquaregrid.com
Vía: delicious.com

2010-10-29

Jo – framework para desarrollo web móvil con HTML5

Jo HTML5 Mobile App Framework Jo   framework para desarrollo web móvil con HTML5

Jo es un framework open source para desarrollo web móvil con HTML5. Con éste es posible desarrollar para plataformas como: webOS, iOS, Android, Symbian, Safari, Chrome y Dashboard Widgets.
Entre las principales características de este framework se destaca su pequeño tamaño (sólo 8 kb), no posee ningún tipo de dependencia, es compatible con otros frameworks Javascript y si bien está en inglés, la documentación es detallada e incluye algunos screencast.

Jo HTML5 Mobile App Framework

Sitio: www.joapp.com
Vía: www.webresourcesdepot.com

iPhone4Simulator – Simula tu sitio web como si navegaras en un iPhone 4


iPhone 4 simulator es un servicio web que nos permite visualizar un sitio web como si fuera un dispositivo móvil iPhone 4. Muy útil si queremos que nuestro sitio tenga la estructura y contenido adaptado para este dispositivo.
Este portal, según sus desarrolladores, sólo se puede ver correctamente desde Mozilla, Safari y Chrome, así que IE tendrá que esperar…
Una buena aplicación para visualizar en pocos segundos nuestro sitio web , sin complicaciones.

2010-10-04

Los mejores 18 frameworks PHP, de menos de 1Mb, ideal para sitio simples

Existen multitud de frameworks disponibles para los desarrolladores de PHP. Los más famosos son CodeIgniter, Symfony, Zend y CakePHP, Kohana. Pero el problema con estos frameworks es que son bastante pesados, debido a la gran cantidad de bibliotecas de contenido que incorporan. Así que en el siguiente enlace se han propuesto analizar los frameworks más ligeros disponibles para PHP.


La selección de frameworks se ha realizado a partir de dos criterios básicos:
El tamaño del framework no podía ser superior a 1Mb.
El framework tenía que haber sido actualizado al menos en 2010



Tabla comparativa

En la siguiente comparación pongo las características más importantes de cada Framework debe contenerdentro de sí mismo. Se analizó el peso finalla fácil instalación, la validez de la documentación y la presencia o ausencia de un foro o un apoyo general en el sitio web.




1. MicroMVC


MicroMVC is a blazing fast Model View Controller framework in less than 150kb. It offers Model, Library, Controller, Function, and View management. Plus other features like URI Routing, hooks/plugins, file uploads, database abstraction, captcha creation, and more. If you are new the Model/View/Controller world of OOP – then this system is for you. Every line is documented and it is as simple of a system to tear-apart as you can get.

Requirements

  • PHP 5
  • Apache mod_rewrite (or similar for other servers)
  • PDO if using the Database
Link: http://micromvc.com/

2. Fat-Free


Condensed in a single 55KB file, the framework’s simple domain-specific language gives you access to Fat-Free’s all-purpose template engine, flexible cache, automatic spam protection, integrated unit testing tools, and code profiler. It’s so small and fast – it even has a bandwidth throttle for controlling Web server traffic. Fat-Free is also packaged with optional plug-ins that extend its capabilities.

Requirements

  • PHP 5.3+
  • Apache mod_rewrite
Link: http://fatfree.sourceforge.net/

3. Flourish


Flourish has a modular architecture, meaning it isn’t strictly MVC. It focuses on being secure, well documented and easy to use, while solving problems intrinsic to web development. The most important features of this framework are the following:
  • Secure
  • Consistent and easy to understand
  • Works with international data
  • Can perform accurate math calculations
  • Easily manipulates images
  • Able to run on different databases (MySQL, PostgreSQL, SQLite, MSSQL, Oracle, DB2)
  • Can be used on closed-source projects
  • Plays nicely with other libraries and frameworks
Another important feature is the download page. In fact, you can customize your download with the classes that you effectively need. In this way you can save more space on your server. It has excellent documentation, but unfortunately the package doesn’t contain files needed to install it. You must create them manually reading the guide.

Requirements

  • PHP 5.1+
  • Needs to create configuration files
Link: http://flourishlib.com/

4. Konstrukt


Konstrukt is a minimalistic framework which provides a foundation on which to build rather than a boxed solution to all problems. It focuses on the controller layer, and tries to encourage the developer to deal directly with the HTTP protocol instead of abstracting it away. Konstrukt uses a hierarchical controller pattern, which provides a greater level of flexibility than the popular routed front controller frameworks.
Key Aspects
  • Controllers are resources
  • URI-to-controller-mapping gives your application a logical structure
  • Routing based on logic rather than rules
  • Nested controllers supports composite view rendering
Design Goals
  • Embrace HTTP rather than hide it
  • Enable the programmer, rather than automating
  • Favour aggregation over code-generation or config-files
  • Encourage encapsulation, and deter use of global scope
  • Limit focus to the controller layer

Requirements

  • PHP 5
Link: http://konstrukt.dk/

5. LightVC


LightVC is a lightweight model-view-controller (MVC) framework without the model. This decoupling allows any model or object relation mapping (ORM) tool to be used, including none at all if one is not needed. As such, LightVC does not couple itself to any non-VC related classes either, such as those for managing sessions, form helpers, and so on. This promotes code reuse by allowing existing code for such tasks be used. The features are:
  • Lightweight single-file view-controller framework
  • Allows usage of any model or ORM
  • Promotes code re-use
  • Highly configurable
  • Fast

Requirements

  • PHP 5
Link: http://www.lightvc.org/

6. Recess PHP


Recess is a RESTful PHP framework that provides a fun and enjoyable development experience for beginner and seasoned developers alike. If you want a full featured RESTful web application without having to master the command line or learn complicated deployment recipes, Recess is for you. Recess is fast, light-weight, and has a very small footprint—ideal for LAMP development and drag-and-drop deployment to shared hosts. Recess is a modern framework that uses a loosely-coupled Model-View-Controller architecture designed and optimized specifically for PHP 5.

Requirements

  • Apache
  • mod_rewrite suggested
  • PHP 5.2.4 or greater
Link: http://www.recessframework.org/

7. Adroit


Adroit is a lightweight PHP 5 MVC framework that is geared towards helping you develop faster. The main motivation behind Adroit is to keep it simple, but provide useful features that developers want. Whether you’re just beginning web-application development, or a seasoned veteran, Adroit can help make that experience better. Adroit provides a lot for how lightweight it is. These are a few of the key benefits:
  • Rapid development
  • Eliminate repetitive tasks
  • Familiar MVC architecture
  • Object Oriented
  • Simple DB persistence
  • Utilizes Smarty Template Engine
  • Simple and Manageable ajax development

Requirements

  • PHP 5
Link: http://adroit.selfcontained.us/

8. EpiCode


EpiCode is an extremely lightweight PHP framework. It includes caching, session, database, form validation, twitter, oauth and asynchronous/non-blocking curl components. EpiCode started off as an MVC framework but has evolved into a set of extremely useful tools. Every tool is completely decoupled so they can be used independently or in conjunction. Each library in EpiCode is thought out and implemented in an extremely cohesive manner.

Requirements

  • mod_rewrite
  • PHP 5
Link: http://github.com/jmathai/epicode

9. Tekuna


Tekuna is a compact framework for web-based applications. It provides a stable basis and a generic infrastructure for your projects. Tekuna has a very small footprint and will not pollute your codebase with unnecessary stuff. The most important features are:
  • Component-oriented Definition of the Application
  • Intuitive Routing of Actions to Controllers
  • Friendly URLs with URI Routing
  • MVC Architecure
  • PHP Error handling with Exceptions (and thus catchable)
  • Separate Request and Response Objects
  • Strict Input Filtering
  • Eliminating the Effects of Magic Quotes
  • Full UTF-8 Support
  • Support for multiple Template Engines
  • Simple Multilanguage Support

Requirements

  • Apache with mod_rewrite
  • PHP 5.2.1+
Link: http://www.tekuna.org

10. Vork


Vork is an open-source PHP framework designed for rapid development of performance-oriented scalable applications. The mission of Vork is to provide an MVC architecture with a full-featured toolkit and universal database support without adding overhead, creating slow & unscalable abstraction layers or re-inventing native PHP functionality.

Requirements

  • PHP – any version between 5.0.2 and 5.3.x
  • A database is optional and any database or cloud-DB that is supported by PHP will work with Vork
  • Built-in support for multiple master/slave database configurations as well as both NoSQL & RDBMS
  • Works on any web server (Apache, Microsoft IIS, etc.)
  • Works with any operating system (Linux, Windows, Mac OS X, FreeBSD, etc.)
  • Integrated caching through any package with a PHP interface (Memcached, etc.)
Link: http://www.vork.us/

11. UltraLite


Vision Media created the UltraLite framework with a need for a light weight, high performance, ajax ready, feature rich framework. UltraLite was built from the ground up with high performance in mind. Page caching, conditional loading, core Content Delivery Network support and much more. You can score a 98% YSlow grade with only core features. The UltraLite features are the following:
  • High Performance
  • Core Cache Drivers
  • Javascript & CSS Compression
  • Database Astraction
  • Cleal URLs
  • Code Hinting
  • Page Cache
  • Slim Source
  • Conditional Loading
  • Simplified Learning Curve
  • Ajax Ready
  • Ajax Plugins
  • Rapid Theme Development
  • Form Builder
  • Form Validation
  • Form Validators

Requirements

  • PHP 5.x
  • MySQL db
Link: http://ultraliteframework.com/

12. Simple PHP Framework


The Simple PHP Framework is a pragmatic approach to building websites with PHP 5. It’s geared towards web design shops and freelance programmers looking for a common foundation to quickly bring web projects to life.

Requirements

  • PHP 5.x
Link: http://clickontyler.com/simple-php-framework/

13. BaseApp Framework


BaseApp Framework is aimed at individual commercial developers or small web application builders who need a starting point.Also if you are a CakePHP User you will find yourself at home with the API. It has support for most common features available in frameworks these days but achieves all this in under 50 Kb of compressed Code. The technical feature of this framework are:
  • PHP 5 with support for new features like autoloading etc
  • Fully MVC ( But can be used as a library also )
  • CakePHP API ( 80 % ) and Layout
  • Active Records and Object Relation Ship Mapping (ORM)
  • Model Validation with complementing form helpers
  • Data Abstraction Layer with Adodb Support ( Almost all databases supported )
  • Extensive Debugging and Exception Handling facilities ( FireBug Support Built in )
  • Extendable Cookie and Session Handling

Requirements

  • PHP 5.x
Link: http://code.google.com/p/baseappframework/

14. Caffeine Web Framework


The latest incarnation of Caffeine Web Framework was written to target PHP 5.1, and is distributed under BSD license. Instead of vague phrases about performance and simplicity here are some architectural highlights:
  • The system uses pure-PHP templates and config files.
  • The directory layout is strictly hierarchical, so if you see something referenced in the code, you will immediately know where to find it.
  • CWF does not use variables in the global namespace.
  • The system uses a single point of access for all HTTP calls. Short URLs are handled in PHP itself, without the need for .htaccess files.
  • Any method of any class that extends Module is automatically callable from the web. Output of echo statements is streamed to the user.
  • There is a subsystem for automatic permission handling.
  • There is an ORM layer, which uses PDO and consists of only two classes. Record handles most of the ORM work, while Link allows for object-oriented management of many-to-many relationships.

Requirements

  • PHP 5.1+
Link: http://framework.korsengineering.com/

15. PHP Peanuts


PhpPeanuts is an open source MVC framework for developing database-backed applications in PHP. It supports high and sustainable developer productivity by default reasoning and the ‘once and only once’ principle. With phpPeanuts you do not build an application from the bottom up. Instead you get one scaffolded from meta data, then extend and refine it step by step to make it more and more like you want it to be. PhpPeanuts does in general not generate code. Instead it generates the application behavior dynamically on each request. It doesn’t do just CRUD, relations and searching are also scaffolded. When you adapt your design the scaffolded parts of your application will adapt dynamically with each request. So you can start with the simpelest thing that could possibly work for your application, and refactor later if the need arises, without losing much productivity. The eXtreme Programming way. PhpPeanuts is not a Ruby on Rails clone, it was released earlier and has together with its predecessors a history of over 16 years. Yet it is only 731 Kb of code. It that can be browsed an seached on line to understand, override and extend it to serve your requirements.

Requirements

  • webserver with PHP version 4.3 or higher;
  • Database that supports full SQL JOIN and LIMIT syntax (with php4 only MySQL and SqlLite are supported, but you can write a Dao class for the database of your choice);
  • modern web browser (IE 6 or up, Mozilla 1.5 or up, try out the examples to see if your browser is OK for phpPeanuts).
Link: http://www.phppeanuts.org

16. Zephyr


Zephyr is an ajax based framework for php5 developers. You can easily develop business applications using this robust framework. this is extremely easy to learn and very simple to implement. You can deliver a full fledged ajax application with strong business layer in backend within some minutes. Installation and deployment of packages that you develop for zephyr is hassle free. Moreover you will get all the features of most popular templating engine “smarty” and powerfull data access layer “adoDB”.

Requirements

  • PHP 5
Link: http://zephyr-php.sourceforge.net

17. Samstyle PHP Framework


Samstyle PHP Framework is a faster, lighter, and ever greater PHP framework that is prepared for development in modern web environment. It has the set of tools, functions and methods ready for web development. Be it email validation, template handling, error management, flexibility, content management, or speed, it is far superior. The project aims to develop a fast, greatly optimized, scalable and easy-to-understand framework for PHP. Samstyle PHP Framework has the following features:
  • Library of functions and support for various PHP versions from 4.4.2 onwards.
  • Model-View-Control-Database-Engine-Core (MVC with DEC) Framework model.
  • Quickly config, deploy and use – no installation required, on any server
  • Easy integration with other APIs, libraries, and applications.
  • Is Open Source, and uses Open Source technologies
  • Framework heavily tested using Simple Test Unit
  • Table Data Gateway and DRY policy
  • Support for AJAX (jQuery), Server-side Cache, Session Security, Input validation, Paging
  • Database Access Layer (DBA) that assists persistence to MySQL, SQLite or SQLite3 databases.
  • JS and CSS Pre-processor that helps to reduce DNS calls and optimize loading
  • Lightweight: the framework (no add-ons and content) is less than 50 KB.
  • Call PHP functions with Javascript through the use of AJAX (after v1.2.6)
  • Firebug debugging for server side (after v1.2.10 Stable)
  • Managed & Easy URL routing without the need to understand how to configure HTACCESS file (after v1.2.12 Alpha).

Requirements

  • PHP 4.4.2+
Link: http://code.google.com/p/samstyle-php-framework/

18. Obullo


Obullo is a Lightweight MVC based Php5 Framework for the PHP Coders who need a simple web toolkit to create full-featured fast web applications. It focuses on being simplicity , readability , performance and writing speed , well documented and easy to use, while solving problems intrinsic to web development. The features are:
  • Obullo use PHP5 static methods.
  • Obullo use PDO (Php Data Objects) for db operations.
  • A new term Global Controllers removes the
    long writing and dirty coding.
  • It works in directory mode, you don’t need put all codes into one controller. One directory can have more controller.
  • Optimized for the minumum code and maximum performance.

Requirements

  • Obullo currently supports PHP 5.1.2 or later versions and recommends the most current release of PHP for critical security and performance enhancements.
  • Obullo use PDO (Php Data Objects) for database operations. Mysql and SQLite drivers is enabled by default as of PHP 5.1.0 and newer versions.
Link: http://obullo.com/

Validar y sanear datos con la extensión Filter de PHP

Introducción: la importancia de validar y sanear datos

Un punto crítico de cualquier tipo de aplicación es la entrada de datos por parte del usuario, ya que, si no se toman las medidas oportunas, un usuario puede (intencionadamente o no) causar fallos en la aplicación.
En el mundo del desarrollo web, esto cobra mucha más importancia, pues se incrementa mucho el número de usuarios potenciales y por tanto, el número de usuarios malintencionados. Ataques conocidos y fáciles de llevar a cabo son SQL Inyection y XSS (Cross Site Scripting).
En aplicaciones web es importante realizar siempre la validación en el lado del servidor.
Otra vulnerabilidad que tiene que ver con la validación, que es debido muchas veces a la inexperiencia del desarrollador, es confiar la validación de lados al lado de cliente (Javascript). Esto es algo grave, pues existen herramientas para enviar datos a una web sin que intervenga para nada un navegador ni Javascript.

La extensión Filter

Esta extensión de PHP nos expone un conjunto de funciones que nos permitirán la validación y saneamiento de datos de una forma sencilla. La funcion filter_var nos permite filtrar una variable según el filtro especificado. El orden de los parámetros es el siguiente:
  • $var: Variable que se quiere filtrar
  • $filter: Filtro que se desea aplicar. Será una constante numérica
  • $options: Conjunto de opciones que modificarán el funcionamiento del filtro. Será una constante numérica o un array
A continuación un listado de filtros de validación posibles:
FILTER_VALIDATE_BOOLEAN
Valida la variable como un booleano.
FILTER_VALIDATE_EMAIL
Valida la variable como una dirección de correo electrónico correcta.
FILTER_VALIDATE_FLOAT
Valida que la variable sea del tipo float.
FILTER_VALIDATE_INT
Valida la variable como un número entero.
FILTER_VALIDATE_IP
Valida la variable como una dirección IP.
FILTER_VALIDATE_REGEXP
Valida la variable contra una expresión regular enviada en la variable de opciones.
FILTER_VALIDATE_URL
Valida el valor coma una URL de acuerdo con la RFC 2396.
A continuación el listado de filtros para sanear:
FILTER_SANITIZE_EMAIL
Elimina todos los caracteres execpto letras, números y !#$%&’*+-/=?^_`{|}~@.[].
FILTER_SANITIZE_ENCODED
Codifica la cadena como una URL válida.
FILTER_SANITIZE_MAGIC_QUOTES
Aplica la función addslashes.
FILTER_SANITIZE_NUMBER_FLOAT
Elimina todos los caracteres excepto números, +- y opcionalmente ,.eE.
FILTER_SANITIZE_NUMBER_INT
Elimina todos los caracteres excepto números y los signos + -.
FILTER_SANITIZE_SPECIAL_CHARS
Escapa caracteres HTML y caracteres con ASCII menor a 32.
FILTER_SANITIZE_STRING
Elimina etiquetas, opcionalmente elimina o codifica caracteres especiales.
FILTER_SANITIZE_STRIPPED
Alias del filtro anterior.
FILTER_SANITIZE_URL
Elimina todos los caracteres excepto números, letras y $-_.+!*’(),{}|\\^~[]`<>#%”;/?:@&=.

Validar y sanear un número entero

Vamos a ver un sencillo ejemplo de validación de un número entero.
  1. <?php  
  2. $var = 123;  
  3. echo filter_var($var, FILTER_VALIDATE_INT);  
La función nos devolverá el entero en caso de que la validación sea correcta, en caso contrario, nos devolverá FALSE.
  1. <?php  
  2. $var = 'dos';  
  3. if(filter_var($var, FILTER_VALIDATE_INT) === false){  
  4.     echo 'Valor incorrecto';  
  5. }else{  
  6.     echo 'Valor correcto';  
  7. }  
A la hora de validar un entero, podemos jugar con las opciones para hacer ajustar el comportamiento de la función a nuestras necesidades. En el siguiente ejemplo se muestra como validar un entero que esté dentro de un rango específico:
  1. array('min_range'=>10, 'max_range' => 20));  
  2.   
  3. if(filter_var($var, FILTER_VALIDATE_INT, $options) === false){  
  4.     echo 'Valor incorrecto';  
  5. }else{  
  6.     echo 'Valor correcto';  
  7. }  
Ahora vamos a ver como sanear un entero, para los que no entiendan, sanear significa limpiar, es decir, quitamos todo lo que no tiene cabida en nuestro campo.
  1. <?php  
  2. $var = 'uno23';  
  3.   
  4. echo filter_var($var, FILTER_SANITIZE_NUMBER_INT);  
El código anterior nos devuelve ’23′ debido a que elimina todos los caracteres no numéricos de la cadena.

Validar y sanear un número float

La validación simple de un float es practicamente igual que la de un entero:
  1. <php  
  2. $var = 1.3;  
  3.   
  4. echo filter_var($var, FILTER_VALIDATE_FLOAT);  
Sin embargo, con este filtro tenemos una opcion interesante que nos permite especificar cual es el caracter que separa los decimales.
  1. <php  
  2. $var = '1,3';  
  3. $options = array('options'=>array('decimal'=>','));  
  4. echo filter_var($var, FILTER_VALIDATE_FLOAT, $options);  

Saneamiento de textos

La limpieza de los textos es algo muy importante y por ello tenemos varios flags que modifican el comporamiento del filtro FILTER_SANITIZE_STRING:
FILTER_FLAG_NO_ENCODE_QUOTES
No codificará las comillas simples ni dobles.
FILTER_FLAG_STRIP_LOW
Elimina caracteres cuyo varlor ASCII sea menor a 32.
FILTER_FLAG_STRIP_HIGH
Elimina caracteres cuyo valor ASCII sea mayor a 127.
FILTER_FLAG_ENCODE_LOW
Codifica caracteres cuyo valor ASCII sea mennor a 32.
FILTER_FLAG_ENCODE_HIGH
Codifica caracteres cuyo valor ASCII sea mayor a 127.
FILTER_FLAG_ENCODE_AMP
Codifica ampersands (&).
A continuación algunos ejemplos:
  1. <php  
  2. $text = '<p>"Hola mundo!"</p>';  
  3. echo filter_var($text, FILTER_SANITIZE_STRING);  
  4. //Resultado: &#34;Hola mundo!&#34;  
  1. <php  
  2. $text = '<p>"Hola mundo!"</p>';  
  3. echo filter_var($text, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);  
  4. //Resultado: "Hola mundo!"  
  1. <php  
  2. $text = '"Ontuts & Cokidoo"';  
  3.   
  4. echo filter_var($text, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES | FILTER_FLAG_ENCODE_AMP);  
  5. //Resultado: "Ontuts & Cokidoo"  

Obtener variables externas

Además de la función filter_var, existe una muy interesante llamada filter_input. Esta funcion nos permite obtener una variable externa por su nombre, filtrándola si es necesario.
Es importante que todas las variables externas, es decir, que nos llegan desde el lado del cliente ($_GET, $_POST, $_COOKIE…) las obtengamos a través de esta función para ahorrarnos disgustos. En el siguiente ejemplo vemos como obtener un parámetro GET de la petición con esta función:
  1. <php  
  2. $page = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);  
  3.   
  4. if($page !== null && $page !== false){  
  5.     //El parametro ha sido enviado y es un entero  
  6. }else{  
  7.     //El parametro no se ha enviado o no es un entero  
  8. }  
Esta función nos devolverá NULL si la variable no ha sido enviada, FALSE si la variable ha sido enviada pero no validada o el valor de la variable si ha sido enviada y validada.
El primer parámetro indica de que ámbito será extraída la variable, y puede ser uno de los siguientes valores:
  • INPUT_GET
  • INPUT_POST
  • INPUT_COOKIE
  • INPUT_SERVER
  • INPUT_ENV
Otra función relacionada y muy interesante es filter_input_array que nos permite definir una serie de validaciones para múltiples campos. Es decir, podemos hacer la validación todos los campos de un formulario en un solo paso. La definición de los campos con sus validaciones se hace mediante un array como se muestra en el siguiente ejemplo:
  1. <?php  
  2. $args = array(  
  3.     'product_id'   => FILTER_SANITIZE_ENCODED,  
  4.     'component'    => array('filter'    => FILTER_VALIDATE_INT,  
  5.                             'flags'     => FILTER_REQUIRE_ARRAY,  
  6.                             'options'   => array('min_range' => 1, 'max_range' => 10)  
  7.                            ),  
  8.     'versions'     => FILTER_SANITIZE_ENCODED  
  9.     );  
  10.   
  11. $myinputs = filter_input_array(INPUT_POST, $args);  
Esta función devuelve un array del tipo clave/valor que contiene los nombres de los campos junto con su filtrado.

Conclusión

Como puedes observar, PHP nos brinda una gran librería con la cual podemos llevar a cabo validaciones y saneamientos en cuestion de segundos, cosa que antes se hacía bastante engorrosa.
Ahora no hay excusa que valga para asegurarnos de que nuestros datos estén bien limpios y seguros :) .
¡Nos vemos en la próxima publicación!

Less Framework 2 - Es otro framework CSS para Celulares-IPad-Netbook-Desktop

Me encontre con este Less Freamework 2 que no sirbe para trabajar con paginas con CSS para Celulares Ipad NetBooks y monitores comunes.
Mas informacion: http://lessframework.com/

2010-10-01

30 Diseño de sitio web sobre café para inspirarnos

Folgers

Coffee Websites - Folgers
Visit Source

Coffeemate

Coffee Websites - Coffee Mate
Visit Source

Caribou Coffee

Coffee Websites - Caribou Coffee
Visit Source

Starbucks Coffee at Home

Coffee Websites - Starbucks
Visit Source

Melitta

Coffee Websites - Melitta
Visit Source

Ambest Coffee

Coffee Websites - Ambest Coffee
Visit Source

Java Cabana

Coffee Websites - Java Cabana
Visit Source

Cafe Marionnette

Coffee Websites - Cafe Marionette
Visit Source

Coffee Club

Coffee Websites - Coffee Club
Visit Source

Double Coffee

Coffee Websites - Double Coffee
Visit Source

Far Coast

Coffee Websites - Far Coast
Visit Source

BOS Coffee Club

Coffee Websites - BOS Coffee Club
Visit Source

Single Origin

Coffee Websites - Single Origin
Visit Source

Cilantro Cafe

Coffee Websites - Cilantro Cafe
Visit Source

Barista

Coffee Websites - Barista
Visit Source

Neweng Land Coffee

Coffee Websites - Neweng Land Coffee
Visit Source

Park Avenue Coffee

Coffee Websites - Park Avenue Coffee
Visit Source

Juan Valdez

Coffee Websites - Juan Valdez
Visit Source

Kapepur

Coffee Websites - Kapepur
Visit Source

Looney Bean

Coffee Websites - Coffee Websites -
Visit Source

Copper Door Coffee

Coffee Websites - Copper Door Coffee
Visit Source

Press CFW

Coffee Websites - Press CFW
Visit Source

Dunn Bros

Coffee Websites - Dunn Bros
Visit Source

Zu Coffee

Coffee Websites - Zu Coffee
Visit Source

Cafebritt

Coffee Websites - Cafebritt
Visit Source

Dunkin Donuts

Coffee Websites - Dunkin Donuts
Visit Source

Uvee Coffee

Coffee Websites - Uvee Coffee
Visit Source

Lavazza

Coffee Websites - Lavazza
Visit Source

Cafe Henrici

Coffee Websites - Cafe Henrici
Visit Source

Tim Hortons

Coffee Websites - Tim Hortons
Visit Source

Wawa Coffee Topia

Coffee Websites - Wawa Coffee Topia
Visit Source