×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: bejoy balan
Added: Sep 22, 2014 5:58 AM
Views: 17
check a library/ extension/class exists or not
  1. <?php
  2.  
  3.   $error = '';
  4.   if (!@class_exists('DOMDocument')) {
  5.     $error .= 'Unable to load DOMDocument class. Failure.<br/>';
  6.   }
  7.   if (!extension_loaded('xsl') || !@class_exists('XSLTProcessor')) {
  8.     $error .= 'Could not load PHP XSL extension. Installing the PHP XSL extension is easy, please contact your server administrator to install libxslt. In some cases PHP might need to be recompiled to add XSL support. You will then be ready to use XTENTO integrations and extensions.';
  9.   }
  10.   if (empty($error)) {
  11.     echo "PHP XSL support is installed. You are ready to use an XTENTO extension or integration.";
  12.   } else {
  13.     echo "Error:<br/>".$error;
  14.   }
  15.  
  16. ?>