/** * Get the internal OpenID Consumer object. If it is not already initialized, do so. * * @return Auth_OpenID_Consumer OpenID consumer object */ function openid_getConsumer() { static $consumer; if (!$consumer) { require_once 'Auth/OpenID/Consumer.php'; $store = openid_getStore(); $consumer = new Auth_OpenID_Consumer($store); if (null === $consumer) { openid_error('OpenID consumer could not be created properly.'); openid_enabled(false); } } return $consumer; }
/** * Get the internal OpenID Consumer object. If it is not already initialized, do so. * * @return Auth_OpenID_Consumer OpenID consumer object */ function openid_getConsumer() { static $consumer; if (!$consumer) { set_include_path( dirname(__FILE__) . PATH_SEPARATOR . get_include_path() ); require_once 'Auth/OpenID/Consumer.php'; restore_include_path(); $store = openid_getStore(); $consumer = new Auth_OpenID_Consumer($store); if( null === $consumer ) { openid_error('OpenID consumer could not be created properly.'); openid_enabled(false); } } return $consumer; }
/** * Get the internal OpenID Consumer object. If it is not already initialized, do so. * * @return Auth_OpenID_Consumer OpenID consumer object */ function openid_getConsumer() { static $consumer; if (!$consumer) { // setup source of randomness $f = @fopen('/dev/urandom', 'r'); if ($f === false) { define('Auth_OpenID_RAND_SOURCE', null); } set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path()); require_once 'Auth/OpenID/Consumer.php'; restore_include_path(); $store = openid_getStore(); $consumer = new Auth_OpenID_Consumer($store); if (null === $consumer) { openid_error('OpenID consumer could not be created properly.'); openid_enabled(false); } } return $consumer; }
/** * Print the status of various system libraries. This is displayed on the main OpenID options page. **/ function openid_printSystemStatus() { global $wp_version, $wpdb; $paths = explode(PATH_SEPARATOR, get_include_path()); for ($i = 0; $i < sizeof($paths); $i++) { $paths[$i] = @realpath($paths[$i]); if (empty($paths[$i])) { unset($paths[$i]); } } $status = array(); $status[] = array('PHP version', 'info', phpversion()); $status[] = array('PHP memory limit', 'info', ini_get('memory_limit')); $status[] = array('Include Path', 'info', $paths); $status[] = array('WordPress version', 'info', $wp_version); $status[] = array('MySQL version', 'info', function_exists('mysql_get_client_info') ? mysql_get_client_info() : 'Mysql client information not available. Very strange, as WordPress requires MySQL.'); $status[] = array('WordPress\' table prefix', 'info', isset($wpdb->base_prefix) ? $wpdb->base_prefix : $wpdb->prefix); if (extension_loaded('suhosin')) { $status[] = array('Curl', false, 'Hardened php (suhosin) extension active -- curl version checking skipped.'); } else { $curl_message = ''; if (function_exists('curl_version')) { $curl_version = curl_version(); if (isset($curl_version['version'])) { $curl_message .= 'Version ' . $curl_version['version'] . '. '; } if (isset($curl_version['ssl_version'])) { $curl_message .= 'SSL: ' . $curl_version['ssl_version'] . '. '; } if (isset($curl_message['libz_version'])) { $curl_message .= 'zlib: ' . $curl_version['libz_version'] . '. '; } if (isset($curl_version['protocols'])) { if (is_array($curl_version['protocols'])) { $curl_message .= 'Supports: ' . implode(', ', $curl_version['protocols']) . '. '; } else { $curl_message .= 'Supports: ' . $curl_version['protocols'] . '. '; } } } else { $curl_message = 'This PHP installation does not have support for libcurl. Some functionality, such as ' . 'fetching https:// URLs, will be missing and performance will slightly impared. See ' . '<a href="http://www.php.net/manual/en/ref.curl.php">php.net/manual/en/ref.curl.php</a> about ' . 'enabling libcurl support for PHP.'; } $status[] = array('Curl Support', isset($curl_version), $curl_message); } if (extension_loaded('gmp') and @gmp_init(1)) { $status[] = array('Big Integer support', true, 'GMP is installed.'); } elseif (extension_loaded('bcmath') and @bcadd(1, 1) == 2) { $status[] = array('Big Integer support', true, 'BCMath is installed (though <a href="http://www.php.net/gmp">GMP</a> is preferred).'); } elseif (defined('Auth_OpenID_NO_MATH_SUPPORT')) { $status[] = array('Big Integer support', false, 'The OpenID Library is operating in Dumb Mode. Recommend installing <a href="http://www.php.net/gmp">GMP</a> support.'); } $status[] = array('Plugin Revision', 'info', OPENID_PLUGIN_REVISION); $status[] = array('Plugin Database Revision', 'info', get_option('openid_db_revision')); if (function_exists('xrds_meta')) { $status[] = array('XRDS-Simple', 'info', 'XRDS-Simple plugin is installed.'); } else { $status[] = array('XRDS-Simple', false, '<a href="http://wordpress.org/extend/plugins/xrds-simple/">XRDS-Simple</a> plugin is not installed. Some features may not work properly (including providing OpenIDs).'); } $openid_enabled = openid_enabled(); $status[] = array('<strong>Overall Plugin Status</strong>', $openid_enabled, $openid_enabled ? '' : 'There are problems above that must be dealt with before the plugin can be used.'); if ($openid_enabled) { // Display status information echo '<div id="openid_rollup" class="updated"> <p><strong>' . __('Status information:', 'openid') . '</strong> ' . __('All Systems Nominal', 'openid') . '<small> (<a href="#" id="openid_rollup_link">' . __('Toggle More/Less', 'openid') . '</a>)</small> </p>'; } else { echo '<div class="error"><p><strong>' . __('Plugin is currently disabled. Fix the problem, then Deactivate/Reactivate the plugin.', 'openid') . '</strong></p>'; } echo '<div>'; foreach ($status as $s) { list($name, $state, $message) = $s; echo '<div><strong>'; if ($state === false) { echo "<span style='color:red;'>[" . __('FAIL', 'openid') . "]</span> {$name}"; } elseif ($state === true) { echo "<span style='color:green;'>[" . __('OK', 'openid') . "]</span> {$name}"; } else { echo "<span style='color:grey;'>[" . __('INFO', 'openid') . "]</span> {$name}"; } echo ($message ? ': ' : '') . '</strong>'; echo is_array($message) ? '<ul><li>' . implode('</li><li>', $message) . '</li></ul>' : $message; echo '</div>'; } echo '</div></div>'; }