Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 3rd, 2013  |  syntax: None  |  size: 1.56 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. require_once( Horder/Autoloader.php );
  2. $autoloader = new Horde_Autoloader();
  3.        
  4. $text_diff = $autoloader->loadClass( 'Hoard_Text_Diff' );
  5.        
  6. require_once 'Horde/Autoloader.php';
  7. require_once 'Horde/Autoloader/ClassPathMapper.php';
  8. require_once 'Horde/Autoloader/ClassPathMapper/Default.php';
  9.  
  10. $autoloader = new Horde_Autoloader();
  11. $autoloader->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Default(__DIR__.'PATH_TO_HORDE_FOLDER'));
  12. $autoloader->registerAutoloader();
  13.  
  14. // if path is correct autoloader should work
  15. $diff = new Horde_Text_Diff();
  16.        
  17. // set the current path to your include_path
  18. set_include_path(__DIR__.'PATH_TO_HORDE_FOLDER');
  19.  
  20. // if you require the default autoloader it will get initialized automatically
  21. require_once 'Horde/Autoloader/Default.php';
  22.  
  23. // use the lib
  24. $diff = new Horde_Text_Diff();
  25.        
  26. // this file:
  27. // C:xampphtdocshordeindex.php
  28.  
  29. // horde folder structure
  30. // C:xampphtdocshordelibHordeAutoloader
  31. // C:xampphtdocshordelibHordeText
  32.  
  33. require_once __DIR__.'/lib/Horde/Autoloader.php';
  34. require_once __DIR__.'/lib/Horde/Autoloader/ClassPathMapper.php';
  35. require_once __DIR__.'/lib/Horde/Autoloader/ClassPathMapper/Default.php';
  36.  
  37. $autoloader = new Horde_Autoloader();
  38. $autoloader->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Default(__DIR__.'/lib'));
  39. $autoloader->registerAutoloader();
  40.  
  41. $compare = array(
  42.     array(
  43.         'foo',
  44.         'bar',
  45.         'foobar'
  46.     ),
  47.     array(
  48.         'foo',
  49.         'bar',
  50.         'foobaz'
  51.     ),
  52. );
  53.  
  54. $diff = new Horde_Text_Diff('auto', $compare);
  55.  
  56. echo '<pre>';
  57. print_r($diff->getDiff());
  58. echo '</pre>';