Advertisement
Guest User

Remove all script from Websites

a guest
May 29th, 2012
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.85 KB | None | 0 0
  1. Index: browserid.php
  2. ===================================================================
  3. --- browserid.php (revision 550258)
  4. +++ browserid.php (working copy)
  5. @@ -57,8 +57,6 @@
  6.  
  7. // Register actions & filters
  8. add_action('init', array(&$this, 'Init'), 0);
  9. - add_action('wp_head', array(&$this, 'WP_head'));
  10. - add_action('login_head', array(&$this, 'Login_head'));
  11. add_filter('login_message', array(&$this, 'Login_message'));
  12. add_action('login_form', array(&$this, 'Login_form'));
  13. add_action('widgets_init', create_function('', 'return register_widget("BrowserID_Widget");'));
  14. @@ -110,15 +108,17 @@
  15. self::Check_assertion();
  16.  
  17. // Enqueue BrowserID scripts
  18. - wp_enqueue_script('browserid', 'https://browserid.org/include.js');
  19. - wp_enqueue_script('browserid_login', plugins_url('login.js', __FILE__), array('browserid'));
  20. + wp_register_script('browserid', 'https://browserid.org/include.js',array(),"",true);
  21. + wp_register_script('browserid_login', plugins_url('login.js', __FILE__), array('browserid'),"",true);
  22.  
  23. // Prepare for comments and bbPress
  24. $options = get_option('browserid_options');
  25. if ((isset($options['browserid_comments']) && $options['browserid_comments']) ||
  26. (isset($options['browserid_bbpress']) && $options['browserid_bbpress'])) {
  27. - wp_enqueue_script('jquery');
  28. - wp_enqueue_script('browserid_comments', plugins_url('comments.js', __FILE__), array('jquery', 'browserid'));
  29. + wp_enqueue_script('browserid_comments', plugins_url('comments.js', __FILE__), array('jquery', 'browserid'),"",true);
  30. + $redirect = (isset($_REQUEST['redirect_to'])) ? urlencode($_REQUEST['redirect_to']) : "";
  31. + $data_array = array('browserid_failed' => __('Verification failed', c_bid_text_domain) );
  32. + wp_localize_script( 'browserid_comments', 'browserid_comments', $data_array );
  33. }
  34. }
  35.  
  36. @@ -360,22 +360,7 @@
  37. $_POST['bbp_anonymous_website'] = $url;
  38. }
  39.  
  40. - // i18n comments
  41. - function WP_head() {
  42. - echo '<script type="text/javascript">' . PHP_EOL;
  43. - echo ' var browserid_failed="' . __('Verification failed', c_bid_text_domain) . '";' . PHP_EOL;
  44. - echo '</script>' . PHP_EOL;
  45. - }
  46.  
  47. - // i18n login
  48. - function Login_head() {
  49. - echo '<script type="text/javascript">' . PHP_EOL;
  50. - echo ' var browserid_siteurl="' . get_site_url(null, '/') . '";' . PHP_EOL;
  51. - echo ' var browserid_redirect=';
  52. - echo (isset($_REQUEST['redirect_to']) ? '"' . urlencode($_REQUEST['redirect_to']) . '"' : 'null') . ';' . PHP_EOL;
  53. - echo ' var browserid_failed="' . __('Verification failed', c_bid_text_domain) . '";' . PHP_EOL;
  54. - echo '</script>' . PHP_EOL;
  55. - }
  56.  
  57. // Filter login error message
  58. function Login_message($message) {
  59. @@ -433,10 +418,14 @@
  60. // Build HTML for login/out button/link
  61. function Get_loginout_html($check_login = true) {
  62. // Get options
  63. + wp_enqueue_script('browserid_login');
  64. + $data_array = array( 'browserid_siteurl' => get_site_url(null, '/'),
  65. + 'browserid_redirect' => $redirect,
  66. + 'browserid_failed' => __('Verification failed', c_bid_text_domain) );
  67. + wp_localize_script( 'browserid_login', 'browserid_text', $data_array );
  68. $options = get_option('browserid_options');
  69.  
  70. - if ($check_login && is_user_logged_in()) {
  71. - // User logged in
  72. + if ($check_login && is_user_logged_in()) { // User logged in
  73. if (empty($options['browserid_logout_html']))
  74. $html = '';
  75. else
  76. Index: comments.js
  77. ===================================================================
  78. --- comments.js (revision 550258)
  79. +++ comments.js (working copy)
  80. @@ -7,7 +7,7 @@
  81. form.find('[type=submit]').click();
  82. }
  83. else
  84. - alert('Verification failed');
  85. + alert(browserid_comments.browserid_failed);
  86. });
  87. return false;
  88. }
  89. Index: login.js
  90. ===================================================================
  91. --- login.js (revision 550258)
  92. +++ login.js (working copy)
  93. @@ -8,15 +8,15 @@
  94. var form = document.createElement('form');
  95. form.setAttribute('style', 'display: none;');
  96. form.method = 'POST';
  97. - form.action = browserid_siteurl;
  98. + form.action = browserid_text.browserid_siteurl;
  99.  
  100. var fields =
  101. [{name: 'browserid_assertion', value: assertion},
  102. {name: 'rememberme', value: rememberme}];
  103. +
  104. + if (browserid_text.browserid_redirect != null)
  105. + fields.push({name: 'redirect_to', value: browserid_text.browserid_redirect});
  106.  
  107. - if (browserid_redirect != null)
  108. - fields.push({name: 'redirect_to', value: browserid_redirect});
  109. -
  110. for (var i = 0; i < fields.length; i++) {
  111. var field = document.createElement('input');
  112. field.type = 'hidden';
  113. @@ -25,10 +25,11 @@
  114. form.appendChild(field);
  115. }
  116.  
  117. +
  118. document.body.appendChild(form).submit();
  119. }
  120. else
  121. - alert(browserid_failed);
  122. + alert(browserid_text.browserid_failed);
  123. });
  124. return false;
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement