Share Pastebin
Guest
Public paste!

alberto

By: a guest | Sep 2nd, 2010 | Syntax: PHP | Size: 1.75 KB | Hits: 23 | Expires: Never
Copy text to clipboard
  1. <?php
  2.  
  3. // Helper function for this sample file.
  4. function printNotFound( $ver )
  5. {
  6.         static $warned;
  7.  
  8.         if (!empty($warned))
  9.                 return;
  10.  
  11.         echo '<p><br><strong><span class="error">Error</span>: '.$ver.' not found</strong>. ' .
  12.                 'This sample assumes that '.$ver.' (not included with CKFinder) is installed in ' .
  13.                 'the "ckeditor" sibling folder of the CKFinder installation folder. If you have it installed in ' .
  14.                 'a different place, just edit this file, changing the wrong paths in the include ' .
  15.                 '(line 57) and the "basePath" values (line 70).</p>' ;
  16.         $warned = true;
  17. }
  18.  
  19. // This is a check for the CKEditor PHP integration file. If not found, the paths must be checked.
  20. // Usually you'll not include it in your site and use correct path in line 57 and basePath in line 70 instead.
  21. // Remove this code after correcting the include_once statement.
  22. if ( !@file_exists( './ckeditor/ckeditor.php' ) )
  23. {
  24.         if ( @file_exists('./ckeditor/ckeditor.js') || @file_exists('./ckeditor/ckeditor_source.js') )
  25.                 printNotFound('CKEditor 3.1+');
  26.         else
  27.                 printNotFound('CKEditor');
  28. }
  29.  
  30. include_once './ckeditor/ckeditor.php' ;
  31. require_once './ckfinder/ckfinder.php' ;
  32.  
  33. // This is a check for the CKEditor class. If not defined, the paths in lines 57 and 70 must be checked.
  34. if (!class_exists('CKEditor'))
  35. {
  36.         printNotFound('CKEditor');
  37. }
  38. else
  39. {
  40.         $initialValue = '' ;
  41.  
  42.         $ckeditor = new CKEditor( ) ;
  43.         $ckeditor->basePath     = './ckeditor/' ;
  44.  
  45.         // Just call CKFinder::SetupCKEditor before calling editor(), replace() or replaceAll()
  46.         // in CKEditor. The second parameter (optional), is the path for the
  47.         // CKFinder installation (default = "/ckfinder/").
  48.         CKFinder::SetupCKEditor( $ckeditor, '/a2gc/ckfinder/' ) ;
  49.  
  50.         $ckeditor->editor('new_new', $initialValue);
  51. }
  52.  
  53. ?>