Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: browserid.php
- ===================================================================
- --- browserid.php (revision 550258)
- +++ browserid.php (working copy)
- @@ -57,8 +57,6 @@
- // Register actions & filters
- add_action('init', array(&$this, 'Init'), 0);
- - add_action('wp_head', array(&$this, 'WP_head'));
- - add_action('login_head', array(&$this, 'Login_head'));
- add_filter('login_message', array(&$this, 'Login_message'));
- add_action('login_form', array(&$this, 'Login_form'));
- add_action('widgets_init', create_function('', 'return register_widget("BrowserID_Widget");'));
- @@ -110,15 +108,17 @@
- self::Check_assertion();
- // Enqueue BrowserID scripts
- - wp_enqueue_script('browserid', 'https://browserid.org/include.js');
- - wp_enqueue_script('browserid_login', plugins_url('login.js', __FILE__), array('browserid'));
- + wp_register_script('browserid', 'https://browserid.org/include.js',array(),"",true);
- + wp_register_script('browserid_login', plugins_url('login.js', __FILE__), array('browserid'),"",true);
- // Prepare for comments and bbPress
- $options = get_option('browserid_options');
- if ((isset($options['browserid_comments']) && $options['browserid_comments']) ||
- (isset($options['browserid_bbpress']) && $options['browserid_bbpress'])) {
- - wp_enqueue_script('jquery');
- - wp_enqueue_script('browserid_comments', plugins_url('comments.js', __FILE__), array('jquery', 'browserid'));
- + wp_enqueue_script('browserid_comments', plugins_url('comments.js', __FILE__), array('jquery', 'browserid'),"",true);
- + $redirect = (isset($_REQUEST['redirect_to'])) ? urlencode($_REQUEST['redirect_to']) : "";
- + $data_array = array('browserid_failed' => __('Verification failed', c_bid_text_domain) );
- + wp_localize_script( 'browserid_comments', 'browserid_comments', $data_array );
- }
- }
- @@ -360,22 +360,7 @@
- $_POST['bbp_anonymous_website'] = $url;
- }
- - // i18n comments
- - function WP_head() {
- - echo '<script type="text/javascript">' . PHP_EOL;
- - echo ' var browserid_failed="' . __('Verification failed', c_bid_text_domain) . '";' . PHP_EOL;
- - echo '</script>' . PHP_EOL;
- - }
- - // i18n login
- - function Login_head() {
- - echo '<script type="text/javascript">' . PHP_EOL;
- - echo ' var browserid_siteurl="' . get_site_url(null, '/') . '";' . PHP_EOL;
- - echo ' var browserid_redirect=';
- - echo (isset($_REQUEST['redirect_to']) ? '"' . urlencode($_REQUEST['redirect_to']) . '"' : 'null') . ';' . PHP_EOL;
- - echo ' var browserid_failed="' . __('Verification failed', c_bid_text_domain) . '";' . PHP_EOL;
- - echo '</script>' . PHP_EOL;
- - }
- // Filter login error message
- function Login_message($message) {
- @@ -433,10 +418,14 @@
- // Build HTML for login/out button/link
- function Get_loginout_html($check_login = true) {
- // Get options
- + wp_enqueue_script('browserid_login');
- + $data_array = array( 'browserid_siteurl' => get_site_url(null, '/'),
- + 'browserid_redirect' => $redirect,
- + 'browserid_failed' => __('Verification failed', c_bid_text_domain) );
- + wp_localize_script( 'browserid_login', 'browserid_text', $data_array );
- $options = get_option('browserid_options');
- - if ($check_login && is_user_logged_in()) {
- - // User logged in
- + if ($check_login && is_user_logged_in()) { // User logged in
- if (empty($options['browserid_logout_html']))
- $html = '';
- else
- Index: comments.js
- ===================================================================
- --- comments.js (revision 550258)
- +++ comments.js (working copy)
- @@ -7,7 +7,7 @@
- form.find('[type=submit]').click();
- }
- else
- - alert('Verification failed');
- + alert(browserid_comments.browserid_failed);
- });
- return false;
- }
- Index: login.js
- ===================================================================
- --- login.js (revision 550258)
- +++ login.js (working copy)
- @@ -8,15 +8,15 @@
- var form = document.createElement('form');
- form.setAttribute('style', 'display: none;');
- form.method = 'POST';
- - form.action = browserid_siteurl;
- + form.action = browserid_text.browserid_siteurl;
- var fields =
- [{name: 'browserid_assertion', value: assertion},
- {name: 'rememberme', value: rememberme}];
- +
- + if (browserid_text.browserid_redirect != null)
- + fields.push({name: 'redirect_to', value: browserid_text.browserid_redirect});
- - if (browserid_redirect != null)
- - fields.push({name: 'redirect_to', value: browserid_redirect});
- -
- for (var i = 0; i < fields.length; i++) {
- var field = document.createElement('input');
- field.type = 'hidden';
- @@ -25,10 +25,11 @@
- form.appendChild(field);
- }
- +
- document.body.appendChild(form).submit();
- }
- else
- - alert(browserid_failed);
- + alert(browserid_text.browserid_failed);
- });
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement