WALL4PHP

From Tera-WURFL

Revision as of 15:24, 2 July 2010 by Kamermans (Talk | contribs)
Jump to: navigation, search

WALL4PHP is the PHP version of the WURFL WALL Library by Luca Passani. It was written by Kaspars Foigts and was originally maintained on the WALL4PHP website.

In order to increase compatibility with Tera-WURFL, an updated version of the library is maintained here at the Tera-WURFL site.

Download

You can download the updated WALL4PHP library from the Tera-WURFL Downloads page.

Installation (Standard Tera-WURFL)

After you download and extract the WALL4PHP library, you must edit [b]wall_prepend.php[/b] (excerpt shown below). On line 28, you need to set the location of your Tera-WURFL installation.

  1. <?php
  2.  
  3. if (!defined('WALL_INCLUDED')) {
  4.  
  5. # We explicitly tell wurfl_class to use cache.php.
  6. # From PHP_Tools by Andrea.
  7. # WARNING: This fails with:
  8. # Notice: Constant LOG_LEVEL already defined in [..path..]/wurfl/wurfl_class.php on line 89
  9. ### define('LOG_LEVEL', 0);
  10.  
  11. # Shall we use classic PHP Tools or Tera WURFL?
  12. define('WALL_USE_TERA_WURFL', true);
  13. # For Tera-WURFL 1.x use '1', for 2.x use '2'
  14. # For the Tera-WURFL Remote Webservice, use 'webservice'
  15. define('TERA_WURFL_VERSION', 2);
  16. # If you are using the Tera-WURFL Remote Webservice, set this to the URL of the webservice
  17. define('TERA_WURFL_WEBSERVICE_URL','http://localhost/Tera-Wurfl/webservice.php');
  18.  
  19. # Configuration of PHP Tools or Tera WURFL by Steve Kamerman
  20. if (defined('WALL_USE_TERA_WURFL') && WALL_USE_TERA_WURFL) {
  21. switch(TERA_WURFL_VERSION){
  22. case 1:
  23. require_once(dirname(__FILE__) . '/tera-wurfl/tera_wurfl_config.php');
  24. break;
  25. case 2:
  26. // For Tera-WURFL 2.x we just need to load the Tera-WURFL class
  27. // TODO: Set this to the location of your TeraWurfl.php file.
  28. require_once(dirname(__FILE__) . '../../Tera-WURFL/TeraWurfl.php');
  29. break;
  30. case 'webservice':
  31. // For the Tera-WURFL 2.x Remote Webservice we just need to load the remote client
  32. // TODO: Set this to the location of your TeraWurflRemoteClient.php file.
  33. require_once(dirname(__FILE__) . '/TeraWurflRemoteClient.php');
  34. break;
  35. }
  36. } else {
  37. require_once(dirname(__FILE__) . '/wurfl/wurfl_config.php');
  38. }

Installation (Remote Webservice)

After you download and extract the WALL4PHP library, you must edit [b]wall_prepend.php[/b] (excerpt shown below).
You can either edit line 33 and provide the location of your [b]TeraWurflRemoteClient.php[/b] file, or you can just copy that file and place it in the WALL4PHP directory.
You will need to set TERA_WURFL_VERSION on line 15 to [b]webservice[/b] (the default is [b]2[/b]).

  1. <?php
  2.  
  3. if (!defined('WALL_INCLUDED')) {
  4.  
  5. # We explicitly tell wurfl_class to use cache.php.
  6. # From PHP_Tools by Andrea.
  7. # WARNING: This fails with:
  8. # Notice: Constant LOG_LEVEL already defined in [..path..]/wurfl/wurfl_class.php on line 89
  9. ### define('LOG_LEVEL', 0);
  10.  
  11. # Shall we use classic PHP Tools or Tera WURFL?
  12. define('WALL_USE_TERA_WURFL', true);
  13. # For Tera-WURFL 1.x use '1', for 2.x use '2'
  14. # For the Tera-WURFL Remote Webservice, use 'webservice'
  15. define('TERA_WURFL_VERSION', 'webservice');
  16. # If you are using the Tera-WURFL Remote Webservice, set this to the URL of the webservice
  17. define('TERA_WURFL_WEBSERVICE_URL','http://localhost/Tera-Wurfl/webservice.php');
  18.  
  19. # Configuration of PHP Tools or Tera WURFL by Steve Kamerman
  20. if (defined('WALL_USE_TERA_WURFL') && WALL_USE_TERA_WURFL) {
  21. switch(TERA_WURFL_VERSION){
  22. case 1:
  23. require_once(dirname(__FILE__) . '/tera-wurfl/tera_wurfl_config.php');
  24. break;
  25. case 2:
  26. // For Tera-WURFL 2.x we just need to load the Tera-WURFL class
  27. // TODO: Set this to the location of your TeraWurfl.php file.
  28. require_once(dirname(__FILE__) . '../../Tera-WURFL/TeraWurfl.php');
  29. break;
  30. case 'webservice':
  31. // For the Tera-WURFL 2.x Remote Webservice we just need to load the remote client
  32. // TODO: Set this to the location of your TeraWurflRemoteClient.php file.
  33. require_once(dirname(__FILE__) . '/TeraWurflRemoteClient.php');
  34. break;
  35. }
  36. } else {
  37. require_once(dirname(__FILE__) . '/wurfl/wurfl_config.php');
  38. }
Personal tools
Namespaces
Variants
Actions
WURFL DBAPI
Toolbox