message;
return $r;
}
/**
* Add OpenID input field to wp-login.php
*
* @action: login_form
**/
function login_form() {
global $wp_version;
$link_class = 'openid_link';
if ($wp_version < '2.5') {
$link_class .= ' legacy';
}
?>
]*)/', '\\1 class="openid_link"' , $html );
}
}
return $html;
}
/**
* Enqueue required javascript libraries.
*
* @action: init
**/
function js_setup() {
if (is_single() || is_comments_popup() || is_admin()) {
wp_enqueue_script( 'jquery' );
wp_enqueue_script('jquery.textnode', '/' . PLUGINDIR . '/openid/files/jquery.textnode.min.js',
array('jquery'), WPOPENID_PLUGIN_REVISION);
wp_enqueue_script('jquery.xpath', '/' . PLUGINDIR . '/openid/files/jquery.xpath.min.js',
array('jquery'), WPOPENID_PLUGIN_REVISION);
wp_enqueue_script('openid', '/' . PLUGINDIR . '/openid/files/openid.min.js',
array('jquery','jquery.textnode'), WPOPENID_PLUGIN_REVISION);
}
}
/**
* Include internal stylesheet.
*
* @action: wp_head, login_head
**/
function style() {
$css_path = get_option('siteurl') . '/' . PLUGINDIR . '/openid/files/openid.css?ver='.WPOPENID_PLUGIN_REVISION;
echo '
';
}
/**
* Print jQuery call for slylizing profile link.
*
* @action: comment_form
**/
function comment_profilelink() {
if (is_user_openid()) {
echo '';
}
}
/**
* Print jQuery call to modify comment form.
*
* @action: comment_form
**/
function comment_form() {
if (!is_user_logged_in()) {
echo '';
}
}
/**
* Spam up the admin interface with warnings.
**/
function admin_notices_plugin_problem_warning() {
echo''.__('The WordPress OpenID plugin is not active.', 'openid').'';
printf(_('Check %sOpenID Options%s for a full diagnositic report.', 'openid'), '', '');
echo '
';
}
/**
* Setup admin menus for OpenID options and ID management.
*
* @action: admin_menu
**/
function add_admin_panels() {
$hookname = add_options_page(__('OpenID options', 'openid'), __('WP-OpenID', 'openid'), 8, 'global-openid-options',
array( 'WordPressOpenID_Interface', 'options_page') );
add_action("load-$hookname", array( 'WordPressOpenID_Interface', 'js_setup' ));
add_action("admin_head-$hookname", array( 'WordPressOpenID_Interface', 'style' ));
$hookname = add_submenu_page('profile.php', __('Your Identity URLs', 'openid'), __('Your Identity URLs', 'openid'),
'read', 'openid', array('WordPressOpenID_Interface', 'profile_panel') );
add_action("admin_head-$hookname", array( 'WordPressOpenID_Interface', 'style' ));
add_action("load-$hookname", array( 'WordPressOpenID_Logic', 'openid_profile_management' ));
}
/*
* Display and handle updates from the Admin screen options page.
*
* @options_page
*/
function options_page() {
global $wp_version, $openid;
WordPressOpenID_Logic::late_bind();
if ( isset($_REQUEST['action']) ) {
switch($_REQUEST['action']) {
case 'rebuild_tables' :
check_admin_referer('wp-openid-info_rebuild_tables');
$openid->store->destroy_tables();
$openid->store->create_tables();
echo ''.__('OpenID tables rebuilt.', 'openid').'
';
break;
}
}
// if we're posted back an update, let's set the values here
if ( isset($_POST['info_update']) ) {
check_admin_referer('wp-openid-info_update');
$error = '';
update_option( 'oid_enable_commentform', isset($_POST['enable_commentform']) ? true : false );
update_option( 'oid_enable_approval', isset($_POST['enable_approval']) ? true : false );
update_option( 'oid_enable_email_mapping', isset($_POST['enable_email_mapping']) ? true : false );
if ($error !== '') {
echo ''.__('At least one of OpenID options was NOT updated', 'openid').''.$error.'
';
} else {
echo ''.__('Open ID options updated', 'openid').'
';
}
}
// Display the options page form
$siteurl = get_option('home');
if( substr( $siteurl, -1, 1 ) !== '/' ) $siteurl .= '/';
?>
= '2.3') { WordPressOpenID_Interface::printSystemStatus(); } ?>
';
WordPressOpenID_Interface::printSystemStatus();
}
} // end function options_page
/**
* Handle user management of OpenID associations.
*
* @submenu_page: profile.php
**/
function profile_panel() {
global $error, $openid;
if( !current_user_can('read') ) {
return;
}
$user = wp_get_current_user();
WordPressOpenID_Logic::late_bind();
if (!$openid->action && $_SESSION['oid_action']) {
$openid->action = $_SESSION['oid_action'];
unset($_SESSION['oid_action']);
}
if (!$openid->message && $_SESSION['oid_message']) {
$openid->message = $_SESSION['oid_message'];
unset($_SESSION['oid_message']);
}
if( 'success' == $openid->action ) {
echo ''.__('Success:', 'openid').' '.$openid->message.'
';
}
elseif( 'warning' == $openid->action ) {
echo ''.__('Warning:', 'openid').' '.$openid->message.'
';
}
elseif( 'error' == $openid->action ) {
echo ''.__('Error:', 'openid').' '.$openid->message.'
';
}
if (!empty($error)) {
echo ''.__('Error:', 'openid').' '.$error.'
';
unset($error);
}
?>
'.__('?', 'openid').'') ?>
store->get_identities($user->ID);
if( count($urls) ) : ?>
There are identities associated with this WordPress user.
'.__('There are no OpenIDs associated with this WordPress user.', 'openid').'';
endif; ?>
setStatus( 'PHP version', 'info', phpversion() );
$openid->setStatus( 'PHP memory limit', 'info', ini_get('memory_limit') );
$openid->setStatus( 'Include Path', 'info', $paths );
$openid->setStatus( 'WordPress version', 'info', $wp_version );
$openid->setStatus( 'MySQL version', 'info', function_exists('mysql_get_client_info') ? mysql_get_client_info() : 'Mysql client information not available. Very strange, as WordPress requires MySQL.' );
$openid->setStatus('WordPress\' table prefix', 'info', isset($wpdb->base_prefix) ? $wpdb->base_prefix : $wpdb->prefix );
if ( extension_loaded('suhosin') ) {
$openid->setStatus( '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'] . '. ';
}
}
}
$openid->setStatus( 'Curl Support', function_exists('curl_version'), function_exists('curl_version') ? $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
' . __('Status information:', 'openid') . ' ' . __('All Systems Nominal', 'openid')
. ' (' . __('Toggle More/Less', 'openid') . ')
';
} else {
echo '
' . __('Plugin is currently disabled. Fix the problem, then Deactivate/Reactivate the plugin.', 'openid')
. '
';
}
echo '
';
foreach( $openid->status as $k=>$v ) {
echo '
';
if( $v['state'] === false ) {
echo "[".__('FAIL', 'openid')."] $k";
} elseif( $v['state'] === true ) {
echo "[".__('OK', 'openid')."] $k";
} else {
echo "[".__('INFO', 'openid')."] $k";
}
echo ($v['message'] ? ': ' : '') . '';
echo (is_array($v['message']) ? '
- ' . implode('
- ', $v['message']) . '
' : $v['message']);
echo '
';
}
echo '
';
}
function repost($action, $parameters) {
$html = '
';
wp_die($html);
}
function init_errors() {
global $error;
$error = $_SESSION['oid_error'];
unset($_SESSION['oid_error']);
}
function repost_comment_anonymously($post) {
$html = '
We were unable to authenticate your claimed OpenID, however you
can continue to post your comment without OpenID:
';
wp_die($html);
}
}
endif;
?>