Changeset 516773
- Timestamp:
- 03/09/2012 02:41:56 PM (14 years ago)
- File:
-
- 1 edited
-
flattr/trunk/flattr.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
flattr/trunk/flattr.php
r516756 r516773 60 60 */ 61 61 protected function frontend() { 62 add_action('wp_enqueue_scripts', array($this, 'insert_script')); 62 if (!in_array(get_option('flattr_button_style'), array('text', 'image'))) { 63 add_action('wp_print_footer_scripts', array($this, 'insert_script')); 64 } 63 65 64 66 if (get_option('flattr_aut') || get_option('flattr_aut_page')) { … … 81 83 */ 82 84 protected function backend() { 85 add_action('wp_print_footer_scripts', array($this, 'insert_script')); 83 86 add_action('admin_init', array($this, 'ajax')); 84 add_action('admin_init', array($this, 'insert_script'));85 87 add_action('admin_init', array($this, 'insert_wizard')); 86 88 add_action('admin_init', array( $this, 'register_settings') ); … … 291 293 } 292 294 293 /**294 * Insert Flattr script between <head></head> tags using Wordpress script hooks295 * @see http://codex.wordpress.org/Function_Reference/wp_enqueue_script296 */297 295 public function insert_script() { 298 wp_deregister_script( 'flattrscript' ); 299 wp_register_script( 'flattrscript', $this->proto . self::API_SCRIPT); 300 wp_enqueue_script( 'flattrscript' ); 296 ?><script type="text/javascript"> 297 (function() { 298 var s = document.createElement('script'), t = document.getElementsByTagName('script')[0]; 299 s.type = 'text/javascript'; 300 s.async = true; 301 s.src = '<?php echo $this->proto . self::API_SCRIPT; ?>'; 302 t.parentNode.insertBefore(s, t); 303 })(); 304 </script><?php 301 305 } 302 306
Note: See TracChangeset
for help on using the changeset viewer.