Geen omschrijving

comments.php 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
  2. require dirname( __FILE__ ) . '/base.php';
  3. use Automattic\Jetpack\Connection\Tokens;
  4. /**
  5. * Main Comments class
  6. *
  7. * @package automattic/jetpack
  8. * @version 1.4
  9. * @since 1.4
  10. */
  11. class Jetpack_Comments extends Highlander_Comments_Base {
  12. /** Variables *************************************************************/
  13. /**
  14. * Possible comment form sources
  15. * @var array
  16. */
  17. public $id_sources = array();
  18. /**
  19. * URL
  20. * @var string
  21. */
  22. public $signed_url = '';
  23. /**
  24. * The default comment form color scheme
  25. * @var string
  26. * @see ::set_default_color_theme_based_on_theme_settings()
  27. */
  28. public $default_color_scheme = 'light';
  29. /** Methods ***************************************************************/
  30. public static function init() {
  31. static $instance = false;
  32. if ( ! $instance ) {
  33. $instance = new Jetpack_Comments;
  34. }
  35. return $instance;
  36. }
  37. /**
  38. * Main constructor for Comments
  39. *
  40. * @since JetpackComments (1.4)
  41. */
  42. public function __construct() {
  43. parent::__construct();
  44. // Comments is loaded
  45. /**
  46. * Fires after the Jetpack_Comments object has been instantiated
  47. *
  48. * @module comments
  49. *
  50. * @since 1.4.0
  51. *
  52. * @param array $jetpack_comments_loaded First element in array of type Jetpack_Comments
  53. **/
  54. do_action_ref_array( 'jetpack_comments_loaded', array( $this ) );
  55. add_action( 'after_setup_theme', array( $this, 'set_default_color_theme_based_on_theme_settings' ), 100 );
  56. }
  57. public function set_default_color_theme_based_on_theme_settings() {
  58. if ( function_exists( 'twentyeleven_get_theme_options' ) ) {
  59. $theme_options = twentyeleven_get_theme_options();
  60. $theme_color_scheme = isset( $theme_options['color_scheme'] ) ? $theme_options['color_scheme'] : 'transparent';
  61. } else {
  62. $theme_color_scheme = get_theme_mod( 'color_scheme', 'transparent' );
  63. }
  64. // Default for $theme_color_scheme is 'transparent' just so it doesn't match 'light' or 'dark'
  65. // The default for Jetpack's color scheme is still defined above as 'light'
  66. if ( false !== stripos( $theme_color_scheme, 'light' ) ) {
  67. $this->default_color_scheme = 'light';
  68. } elseif ( false !== stripos( $theme_color_scheme, 'dark' ) ) {
  69. $this->default_color_scheme = 'dark';
  70. }
  71. }
  72. /** Private Methods *******************************************************/
  73. /**
  74. * Set any global variables or class variables
  75. * @since JetpackComments (1.4)
  76. */
  77. protected function setup_globals() {
  78. parent::setup_globals();
  79. // Sources
  80. $this->id_sources = array(
  81. 'guest',
  82. 'jetpack',
  83. 'wordpress',
  84. 'twitter',
  85. 'facebook',
  86. );
  87. }
  88. /**
  89. * Setup actions for methods in this class
  90. * @since JetpackComments (1.4)
  91. */
  92. protected function setup_actions() {
  93. parent::setup_actions();
  94. // Selfishly remove everything from the existing comment form
  95. remove_all_actions( 'comment_form_before' );
  96. // Selfishly add only our actions back to the comment form
  97. add_action( 'comment_form_before', array( $this, 'comment_form_before' ) );
  98. add_action( 'comment_form_after', array( $this, 'comment_form_after' ), 1 ); // Set very early since we remove everything outputed before our action.
  99. // Before a comment is posted
  100. add_action( 'pre_comment_on_post', array( $this, 'pre_comment_on_post' ), 1 );
  101. // After a comment is posted
  102. add_action( 'comment_post', array( $this, 'add_comment_meta' ) );
  103. }
  104. /**
  105. * Setup filters for methods in this class
  106. * @since 1.6.2
  107. */
  108. protected function setup_filters() {
  109. parent::setup_filters();
  110. add_filter( 'comment_post_redirect', array( $this, 'capture_comment_post_redirect_to_reload_parent_frame' ), 100 );
  111. add_filter( 'get_avatar', array( $this, 'get_avatar' ), 10, 4 );
  112. }
  113. /**
  114. * Get the comment avatar from Gravatar, Twitter, or Facebook
  115. *
  116. * @since JetpackComments (1.4)
  117. *
  118. * @param string $avatar Current avatar URL
  119. * @param string $comment Comment for the avatar
  120. * @param int $size Size of the avatar
  121. * @param string $default Not used
  122. *
  123. * @return string New avatar
  124. */
  125. public function get_avatar( $avatar, $comment, $size, $default ) {
  126. if ( ! isset( $comment->comment_post_ID ) || ! isset( $comment->comment_ID ) ) {
  127. // it's not a comment - bail
  128. return $avatar;
  129. }
  130. // Detect whether it's a Facebook or Twitter avatar
  131. $foreign_avatar = get_comment_meta( $comment->comment_ID, 'hc_avatar', true );
  132. $foreign_avatar_hostname = wp_parse_url( $foreign_avatar, PHP_URL_HOST );
  133. if ( ! $foreign_avatar_hostname ||
  134. ! preg_match( '/\.?(graph\.facebook\.com|twimg\.com)$/', $foreign_avatar_hostname ) ) {
  135. return $avatar;
  136. }
  137. // Return the FB or Twitter avatar
  138. return preg_replace( '#src=([\'"])[^\'"]+\\1#', 'src=\\1' . esc_url( set_url_scheme( $this->photon_avatar( $foreign_avatar, $size ), 'https' ) ) . '\\1', $avatar );
  139. }
  140. /** Output Methods ********************************************************/
  141. /**
  142. * Start capturing the core comment_form() output
  143. * @since JetpackComments (1.4)
  144. */
  145. public function comment_form_before() {
  146. /**
  147. * Filters the setting that determines if Jetpack comments should be enabled for
  148. * the current post type.
  149. *
  150. * @module comments
  151. *
  152. * @since 3.8.1
  153. *
  154. * @param boolean $return Should comments be enabled?
  155. */
  156. if ( ! apply_filters( 'jetpack_comment_form_enabled_for_' . get_post_type(), true ) ) {
  157. return;
  158. }
  159. // Add some JS to the footer
  160. add_action( 'wp_footer', array( $this, 'watch_comment_parent' ), 100 );
  161. ob_start();
  162. }
  163. /**
  164. * Noop the default comment form output, get some options, and output our
  165. * tricked out totally radical comment form.
  166. *
  167. * @since JetpackComments (1.4)
  168. */
  169. public function comment_form_after() {
  170. /** This filter is documented in modules/comments/comments.php */
  171. if ( ! apply_filters( 'jetpack_comment_form_enabled_for_' . get_post_type(), true ) ) {
  172. return;
  173. }
  174. // Throw it all out and drop in our replacement
  175. ob_end_clean();
  176. // If users are required to be logged in, and they're not, then we don't need to do anything else
  177. if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
  178. /**
  179. * Changes the log in to comment prompt.
  180. *
  181. * @module comments
  182. *
  183. * @since 1.4.0
  184. *
  185. * @param string $var Default is "You must log in to post a comment."
  186. */
  187. echo '<p class="must-log-in">' . sprintf( apply_filters( 'jetpack_must_log_in_to_comment', __( 'You must <a href="%s">log in</a> to post a comment.', 'jetpack' ) ), wp_login_url( get_permalink() . '#respond' ) ) . '</p>';
  188. return;
  189. }
  190. if ( in_array( 'subscriptions', Jetpack::get_active_modules() ) ) {
  191. $stb_enabled = get_option( 'stb_enabled', 1 );
  192. $stb_enabled = empty( $stb_enabled ) ? 0 : 1;
  193. $stc_enabled = get_option( 'stc_enabled', 1 );
  194. $stc_enabled = empty( $stc_enabled ) ? 0 : 1;
  195. } else {
  196. $stb_enabled = 0;
  197. $stc_enabled = 0;
  198. }
  199. $params = array(
  200. 'blogid' => Jetpack_Options::get_option( 'id' ),
  201. 'postid' => get_the_ID(),
  202. 'comment_registration' => ( get_option( 'comment_registration' ) ? '1' : '0' ), // Need to explicitly send a '1' or a '0' for these
  203. 'require_name_email' => ( get_option( 'require_name_email' ) ? '1' : '0' ),
  204. 'stc_enabled' => $stc_enabled,
  205. 'stb_enabled' => $stb_enabled,
  206. 'show_avatars' => ( get_option( 'show_avatars' ) ? '1' : '0' ),
  207. 'avatar_default' => get_option( 'avatar_default' ),
  208. 'greeting' => get_option( 'highlander_comment_form_prompt', __( 'Leave a Reply', 'jetpack' ) ),
  209. /**
  210. * Changes the comment form prompt.
  211. *
  212. * @module comments
  213. *
  214. * @since 2.3.0
  215. *
  216. * @param string $var Default is "Leave a Reply to %s."
  217. */
  218. 'greeting_reply' => apply_filters( 'jetpack_comment_form_prompt_reply', __( 'Leave a Reply to %s', 'jetpack' ) ),
  219. 'color_scheme' => get_option( 'jetpack_comment_form_color_scheme', $this->default_color_scheme ),
  220. 'lang' => get_locale(),
  221. 'jetpack_version' => JETPACK__VERSION,
  222. );
  223. // Extra parameters for logged in user
  224. if ( is_user_logged_in() ) {
  225. $current_user = wp_get_current_user();
  226. $params['hc_post_as'] = 'jetpack';
  227. $params['hc_userid'] = $current_user->ID;
  228. $params['hc_username'] = $current_user->display_name;
  229. $params['hc_userurl'] = $current_user->user_url;
  230. $params['hc_useremail'] = md5( strtolower( trim( $current_user->user_email ) ) );
  231. if ( current_user_can( 'unfiltered_html' ) ) {
  232. $params['_wp_unfiltered_html_comment'] = wp_create_nonce( 'unfiltered-html-comment_' . get_the_ID() );
  233. }
  234. } else {
  235. $commenter = wp_get_current_commenter();
  236. $params['show_cookie_consent'] = (int) has_action( 'set_comment_cookies', 'wp_set_comment_cookies' );
  237. $params['has_cookie_consent'] = (int) ! empty( $commenter['comment_author_email'] );
  238. }
  239. $blog_token = ( new Tokens() )->get_access_token();
  240. list( $token_key ) = explode( '.', $blog_token->secret, 2 );
  241. // Prophylactic check: anything else should never happen.
  242. if ( $token_key && $token_key !== $blog_token->secret ) {
  243. // Is the token a Special Token (@see class.tokens.php)?
  244. if ( preg_match( '/^;.\d+;\d+;$/', $token_key, $matches ) ) {
  245. // The token key for a Special Token is public.
  246. $params['token_key'] = $token_key;
  247. } else {
  248. /*
  249. * The token key for a Normal Token is public but
  250. * looks like sensitive data. Since there can only be
  251. * one Normal Token per site, avoid concern by
  252. * sending the magic "use the Normal Token" token key.
  253. */
  254. $params['token_key'] = Tokens::MAGIC_NORMAL_TOKEN_KEY;
  255. }
  256. }
  257. $signature = Jetpack_Comments::sign_remote_comment_parameters( $params, $blog_token->secret );
  258. if ( is_wp_error( $signature ) ) {
  259. $signature = 'error';
  260. }
  261. $params['sig'] = $signature;
  262. $url_origin = 'https://jetpack.wordpress.com';
  263. $url = "{$url_origin}/jetpack-comment/?" . http_build_query( $params );
  264. $url = "{$url}#parent=" . urlencode( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) );
  265. $this->signed_url = $url;
  266. $height = $params['comment_registration'] || is_user_logged_in() ? '315' : '430'; // Iframe can be shorter if we're not allowing guest commenting
  267. $transparent = ( $params['color_scheme'] == 'transparent' ) ? 'true' : 'false';
  268. if ( isset( $_GET['replytocom'] ) ) {
  269. $url .= '&replytocom=' . (int) $_GET['replytocom'];
  270. }
  271. /**
  272. * Filter whether the comment title can be displayed.
  273. *
  274. * @module comments
  275. *
  276. * @since 4.7.0
  277. *
  278. * @param bool $show Can the comment be displayed? Default to true.
  279. */
  280. $show_greeting = apply_filters( 'jetpack_comment_form_display_greeting', true );
  281. // The actual iframe (loads comment form from Jetpack server)
  282. $is_amp = Jetpack_AMP_Support::is_amp_request();
  283. ?>
  284. <div id="respond" class="comment-respond">
  285. <?php if ( true === $show_greeting ) : ?>
  286. <h3 id="reply-title" class="comment-reply-title"><?php comment_form_title( esc_html( $params['greeting'] ), esc_html( $params['greeting_reply'] ) ); ?>
  287. <small><?php cancel_comment_reply_link( esc_html__( 'Cancel reply', 'jetpack' ) ); ?></small>
  288. </h3>
  289. <?php endif; ?>
  290. <form id="commentform" class="comment-form">
  291. <iframe
  292. title="<?php esc_attr_e( 'Comment Form', 'jetpack' ); ?>"
  293. src="<?php echo esc_url( $url ); ?>"
  294. <?php if ( $is_amp ) : ?>
  295. resizable
  296. layout="fixed-height"
  297. height="<?php echo esc_attr( $height ); ?>"
  298. <?php else : ?>
  299. name="jetpack_remote_comment"
  300. style="width:100%; height: <?php echo esc_attr( $height ); ?>px; border:0;"
  301. <?php endif; ?>
  302. class="jetpack_remote_comment"
  303. id="jetpack_remote_comment"
  304. sandbox="allow-same-origin allow-top-navigation allow-scripts allow-forms allow-popups"
  305. >
  306. <?php if ( $is_amp ) : ?>
  307. <button overflow><?php esc_html_e( 'Show more', 'jetpack' ); ?></button>
  308. <?php endif; ?>
  309. </iframe>
  310. <?php if ( ! $is_amp ) : ?>
  311. <!--[if !IE]><!-->
  312. <script>
  313. document.addEventListener('DOMContentLoaded', function () {
  314. var commentForms = document.getElementsByClassName('jetpack_remote_comment');
  315. for (var i = 0; i < commentForms.length; i++) {
  316. commentForms[i].allowTransparency = <?php echo $transparent; ?>;
  317. commentForms[i].scrolling = 'no';
  318. }
  319. });
  320. </script>
  321. <!--<![endif]-->
  322. <?php endif; ?>
  323. </form>
  324. </div>
  325. <?php // Below is required for comment reply JS to work ?>
  326. <input type="hidden" name="comment_parent" id="comment_parent" value="" />
  327. <?php
  328. }
  329. /**
  330. * Add some JS to wp_footer to watch for hierarchical reply parent change
  331. *
  332. * @since JetpackComments (1.4)
  333. */
  334. public function watch_comment_parent() {
  335. if ( Jetpack_AMP_Support::is_amp_request() ) {
  336. // @todo Implement AMP support.
  337. return;
  338. }
  339. $url_origin = 'https://jetpack.wordpress.com';
  340. ?>
  341. <!--[if IE]>
  342. <script type="text/javascript">
  343. if ( 0 === window.location.hash.indexOf( '#comment-' ) ) {
  344. // window.location.reload() doesn't respect the Hash in IE
  345. window.location.hash = window.location.hash;
  346. }
  347. </script>
  348. <![endif]-->
  349. <script type="text/javascript">
  350. (function () {
  351. var comm_par_el = document.getElementById( 'comment_parent' ),
  352. comm_par = ( comm_par_el && comm_par_el.value ) ? comm_par_el.value : '',
  353. frame = document.getElementById( 'jetpack_remote_comment' ),
  354. tellFrameNewParent;
  355. tellFrameNewParent = function () {
  356. if ( comm_par ) {
  357. frame.src = "<?php echo esc_url_raw( $this->signed_url ); ?>" + '&replytocom=' + parseInt( comm_par, 10 ).toString();
  358. } else {
  359. frame.src = "<?php echo esc_url_raw( $this->signed_url ); ?>";
  360. }
  361. };
  362. <?php if ( get_option( 'thread_comments' ) && get_option( 'thread_comments_depth' ) ) : ?>
  363. if ( 'undefined' !== typeof addComment ) {
  364. addComment._Jetpack_moveForm = addComment.moveForm;
  365. addComment.moveForm = function ( commId, parentId, respondId, postId ) {
  366. var returnValue = addComment._Jetpack_moveForm( commId, parentId, respondId, postId ),
  367. cancelClick, cancel;
  368. if ( false === returnValue ) {
  369. cancel = document.getElementById( 'cancel-comment-reply-link' );
  370. cancelClick = cancel.onclick;
  371. cancel.onclick = function () {
  372. var cancelReturn = cancelClick.call( this );
  373. if ( false !== cancelReturn ) {
  374. return cancelReturn;
  375. }
  376. if ( ! comm_par ) {
  377. return cancelReturn;
  378. }
  379. comm_par = 0;
  380. tellFrameNewParent();
  381. return cancelReturn;
  382. };
  383. }
  384. if ( comm_par == parentId ) {
  385. return returnValue;
  386. }
  387. comm_par = parentId;
  388. tellFrameNewParent();
  389. return returnValue;
  390. };
  391. }
  392. <?php endif; ?>
  393. // Do the post message bit after the dom has loaded.
  394. document.addEventListener( 'DOMContentLoaded', function () {
  395. var iframe_url = <?php echo json_encode( esc_url_raw( $url_origin ) ); ?>;
  396. if ( window.postMessage ) {
  397. if ( document.addEventListener ) {
  398. window.addEventListener( 'message', function ( event ) {
  399. var origin = event.origin.replace( /^http:\/\//i, 'https://' );
  400. if ( iframe_url.replace( /^http:\/\//i, 'https://' ) !== origin ) {
  401. return;
  402. }
  403. frame.style.height = event.data + 'px';
  404. });
  405. } else if ( document.attachEvent ) {
  406. window.attachEvent( 'message', function ( event ) {
  407. var origin = event.origin.replace( /^http:\/\//i, 'https://' );
  408. if ( iframe_url.replace( /^http:\/\//i, 'https://' ) !== origin ) {
  409. return;
  410. }
  411. frame.style.height = event.data + 'px';
  412. });
  413. }
  414. }
  415. })
  416. })();
  417. </script>
  418. <?php
  419. }
  420. /**
  421. * Verify the hash included in remote comments.
  422. *
  423. * @since JetpackComments (1.4)
  424. *
  425. * @param type $comment Not used
  426. */
  427. public function pre_comment_on_post( $comment ) {
  428. $post_array = stripslashes_deep( $_POST );
  429. // Bail if missing the Jetpack token
  430. if ( ! isset( $post_array['sig'] ) || ! isset( $post_array['token_key'] ) ) {
  431. unset( $_POST['hc_post_as'] );
  432. return;
  433. }
  434. if ( false !== strpos( $post_array['hc_avatar'], '.gravatar.com' ) ) {
  435. $post_array['hc_avatar'] = htmlentities( $post_array['hc_avatar'] );
  436. }
  437. $blog_token = ( new Tokens() )->get_access_token( false, $post_array['token_key'] );
  438. if ( ! $blog_token ) {
  439. wp_die( __( 'Unknown security token.', 'jetpack' ), 400 );
  440. }
  441. $check = Jetpack_Comments::sign_remote_comment_parameters( $post_array, $blog_token->secret );
  442. if ( is_wp_error( $check ) ) {
  443. wp_die( $check );
  444. }
  445. // Bail if token is expired or not valid
  446. if ( ! hash_equals( $check, $post_array['sig'] ) ) {
  447. wp_die( __( 'Invalid security token.', 'jetpack' ), 400 );
  448. }
  449. /** This filter is documented in modules/comments/comments.php */
  450. if ( ! apply_filters( 'jetpack_comment_form_enabled_for_' . get_post_type( $post_array['comment_post_ID'] ), true ) ) {
  451. // In case the comment POST is legit, but the comments are
  452. // now disabled, we don't allow the comment
  453. wp_die( __( 'Comments are not allowed.', 'jetpack' ), 403 );
  454. }
  455. }
  456. /** Capabilities **********************************************************/
  457. /**
  458. * Add some additional comment meta after comment is saved about what
  459. * service the comment is from, the avatar, user_id, etc...
  460. *
  461. * @since JetpackComments (1.4)
  462. *
  463. * @param type $comment_id
  464. */
  465. public function add_comment_meta( $comment_id ) {
  466. $comment_meta = array();
  467. switch ( $this->is_highlander_comment_post() ) {
  468. case 'facebook':
  469. $comment_meta['hc_post_as'] = 'facebook';
  470. $comment_meta['hc_avatar'] = stripslashes( $_POST['hc_avatar'] );
  471. $comment_meta['hc_foreign_user_id'] = stripslashes( $_POST['hc_userid'] );
  472. break;
  473. case 'twitter':
  474. $comment_meta['hc_post_as'] = 'twitter';
  475. $comment_meta['hc_avatar'] = stripslashes( $_POST['hc_avatar'] );
  476. $comment_meta['hc_foreign_user_id'] = stripslashes( $_POST['hc_userid'] );
  477. break;
  478. // phpcs:ignore WordPress.WP.CapitalPDangit
  479. case 'wordpress':
  480. // phpcs:ignore WordPress.WP.CapitalPDangit
  481. $comment_meta['hc_post_as'] = 'wordpress';
  482. $comment_meta['hc_avatar'] = stripslashes( $_POST['hc_avatar'] );
  483. $comment_meta['hc_foreign_user_id'] = stripslashes( $_POST['hc_userid'] );
  484. $comment_meta['hc_wpcom_id_sig'] = stripslashes( $_POST['hc_wpcom_id_sig'] ); //since 1.9
  485. break;
  486. case 'jetpack':
  487. $comment_meta['hc_post_as'] = 'jetpack';
  488. $comment_meta['hc_avatar'] = stripslashes( $_POST['hc_avatar'] );
  489. $comment_meta['hc_foreign_user_id'] = stripslashes( $_POST['hc_userid'] );
  490. break;
  491. }
  492. // Bail if no extra comment meta
  493. if ( empty( $comment_meta ) ) {
  494. return;
  495. }
  496. // Loop through extra meta and add values
  497. foreach ( $comment_meta as $key => $value ) {
  498. add_comment_meta( $comment_id, $key, $value, true );
  499. }
  500. }
  501. function capture_comment_post_redirect_to_reload_parent_frame( $url ) {
  502. if ( ! isset( $_GET['for'] ) || 'jetpack' != $_GET['for'] ) {
  503. return $url;
  504. }
  505. ?>
  506. <!DOCTYPE html>
  507. <html <?php language_attributes(); ?>>
  508. <!--<![endif]-->
  509. <head>
  510. <meta charset="<?php bloginfo( 'charset' ); ?>" />
  511. <title><?php printf( __( 'Submitting Comment%s', 'jetpack' ), '&hellip;' ); ?></title>
  512. <style type="text/css">
  513. body {
  514. display: table;
  515. width: 100%;
  516. height: 60%;
  517. position: absolute;
  518. top: 0;
  519. left: 0;
  520. overflow: hidden;
  521. color: #333;
  522. }
  523. h1 {
  524. text-align: center;
  525. margin: 0;
  526. padding: 0;
  527. display: table-cell;
  528. vertical-align: middle;
  529. font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;
  530. font-weight: normal;
  531. }
  532. .hidden {
  533. opacity: 0;
  534. }
  535. h1 span {
  536. -moz-transition-property: opacity;
  537. -moz-transition-duration: 1s;
  538. -moz-transition-timing-function: ease-in-out;
  539. -webkit-transition-property: opacity;
  540. -webkit-transition-duration: 1s;
  541. -webbit-transition-timing-function: ease-in-out;
  542. -o-transition-property: opacity;
  543. -o-transition-duration: 1s;
  544. -o-transition-timing-function: ease-in-out;
  545. -ms-transition-property: opacity;
  546. -ms-transition-duration: 1s;
  547. -ms-transition-timing-function: ease-in-out;
  548. transition-property: opacity;
  549. transition-duration: 1s;
  550. transition-timing-function: ease-in-out;
  551. }
  552. </style>
  553. </head>
  554. <body>
  555. <h1><?php printf( __( 'Submitting Comment%s', 'jetpack' ), '<span id="ellipsis" class="hidden">&hellip;</span>' ); ?></h1>
  556. <script type="text/javascript">
  557. try {
  558. window.parent.location = <?php echo json_encode( $url ); ?>;
  559. window.parent.location.reload(true);
  560. } catch (e) {
  561. window.location = <?php echo json_encode( $url ); ?>;
  562. window.location.reload(true);
  563. }
  564. ellipsis = document.getElementById('ellipsis');
  565. function toggleEllipsis() {
  566. ellipsis.className = ellipsis.className ? '' : 'hidden';
  567. }
  568. setInterval(toggleEllipsis, 1200);
  569. </script>
  570. </body>
  571. </html>
  572. <?php
  573. exit;
  574. }
  575. }
  576. Jetpack_Comments::init();