CFDBCheckZendFramework

"Contact Form to Database" Copyright (C) 2011-2012 Michael Simpson (email : michael.d.simpson@gmail.com).

Defined (1)

The class is defined in the following location(s).

/CFDBCheckZendFramework.php  
  1. class CFDBCheckZendFramework { 
  2.  
  3. /** 
  4. * Checks for the existence of the Zend Framework. If not found, prints out some (hopefully) helpful information 
  5. * @return bool true if Zend is found, *but* if not found calls wp_die() 
  6. */ 
  7. public static function checkIncludeZend() { 
  8. if (!(include 'Zend/Loader.php')) { 
  9. ob_start(); 
  10. ?> 
  11. <h1>Missing Zend Framework</h1> 
  12. <p> 
  13. This function requires part of the Zend framework that interacts with Google. <br/> 
  14. It appears that either: 
  15. </p> 
  16. <ol> 
  17. <li>The Zend Framework is not on the include_path or</li> 
  18. <li>You do not have the Zend Framework installed</li> 
  19. </ol> 
  20. <p> 
  21. <code>include_path="<?php echo(ini_get('include_path'));?>"</code><br/> 
  22. <code>php.ini file is 
  23. "<?php $phpInfo = CFDBCheckZendFramework::getPhpInfo(); echo($phpInfo['Loaded Configuration File']);?> 
  24. "</code><br/> 
  25. </p> 
  26. <ol> 
  27. <li>locate the the <span style="font-weight: bold;">Zend</span> directory on your computer</li> 
  28. <li>If found, here is one way to put it on the include path</li> 
  29. <ol> 
  30. <li style="list-style: lower-roman">copy the <span style="font-weight: bold;">php.ini</span> file to your WordPress installation to 
  31. <span style="font-weight: bold;">[wp-dir]/wp-content/plugins/contact-form-7-to-database-extension/php.ini</span> 
  32. </li> 
  33. <li style="list-style: lower-roman">add a line to this new file:<br/> 
  34. <code>include_path="<?php echo(ini_get('include_path') . PATH_SEPARATOR . "[Zend-parent-directory]");?>"</code> 
  35. </li> 
  36. </ol> 
  37. <li>If not found, install and configure Zend version 1.11.11 (or contact or administrator or host provider)<br/> 
  38. See: <a target="_blank" href="http://code.google.com/apis/gdata/articles/php_client_lib.html">Getting 
  39. Started 
  40. with the Google Data PHP Client Library</a><br/> 
  41. To download the part of Zend 1.11.11 required, see: <a target="_blank" 
  42. href="http://framework.zend.com/download/gdata/">Zend 
  43. GData</a> 
  44. </li> 
  45. </ol> 
  46. <?php 
  47. $errorHtml = ob_get_contents(); 
  48. ob_end_clean(); 
  49. include_once('CFDBDie.php'); 
  50. CFDBDie::wp_die($errorHtml,  
  51. __('Missing Zend Framework', 'contact-form-7-to-database-extension'),  
  52. array('response' => 200, 'back_link' => true)); 
  53.  
  54. // Doesn't actually return because we call wp_die 
  55. return false; 
  56. return true; 
  57.  
  58.  
  59. /** 
  60. * Taken from: http://www.php.net/manual/en/function.phpinfo.php#87214 
  61. * @return array key => array(values) from phpinfo call 
  62. */ 
  63. private static function getPhpInfo() { 
  64. ob_start(); 
  65. phpinfo(INFO_GENERAL); 
  66. $phpinfo = array('phpinfo' => array()); 
  67. if (preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) 
  68. foreach ($matches as $match) 
  69. if (strlen($match[1])) 
  70. $phpinfo[$match[1]] = array(); 
  71. elseif (isset($match[3])) 
  72. $phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3]; 
  73. else 
  74. $phpinfo[end(array_keys($phpinfo))][] = $match[2]; 
  75. return $phpinfo['phpinfo'];