0

when i install this wordpress plugin it gives me:

The plugin generated 189 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.  

this is my code:

add_action('wp_head', 'wpse_43672_wp_head', 0);
/**
 * Hooks into the `wp_head` action.
*/
function wpse_43672_wp_head(){ ?>
       <script>
       if (navigator.userAgent.match(/Android/i) ||
             navigator.userAgent.match(/webOS/i) ||
             navigator.userAgent.match(/iPhone/i) ||
             navigator.userAgent.match(/iPad/i) ||
             navigator.userAgent.match(/iPod/i) ||
             navigator.userAgent.match(/BlackBerry/) || 
             navigator.userAgent.match(/Windows Phone/i) || 
             navigator.userAgent.match(/ZuneWP7/i)
             ) {
                // some code
                self.location="<?php echo plugins_url(); ?>/zeevmobile/mobile-page.php";
               }
        </script>
<?php }?>
<style>
li#toplevel_page_zeevmobile-zeevmobile .wp-menu-image {
    background: url(<?php echo plugins_url(); ?>/zeevmobile/images/icon.png) no-repeat 4px !important;
}
</style>
<?php
// create custom plugin settings menu  
add_action('admin_menu', 'zeev_create_menu');  
function zeev_create_menu() {  
    //create new top-level menu  
    add_menu_page('zeev movile redirect', 'zeev mobile', 'administrator', __FILE__, 'zeev_settings_page');  
      //create new top-level menu  
    //call register settings function  
    add_action( 'admin_init', 'register_mysettings' );  
}  
function register_mysettings() {  
    //register our settings  
    register_setting( 'zeev-settings-group', 'zeev_above_text' ); 
    register_setting( 'zeev-settings-group', 'zeev_normal_site' );  
    register_setting( 'zeev-settings-group', 'zeev_mobile_site' );  
} 
function zeev_settings_page() {  
?>  
<div class="wrap">  
<h2>Your Mobile Buttons Links</h2>  
<form method="post" action="options.php">       
    <?php settings_fields('zeev-settings-group'); ?>  
    <table class="form-table">  
        <tr valign="top">  
        <th scope="row">Some text above buttons</th>
        <td><textarea name="zeev_above_text" cols="90"><?php echo get_option('zeev_above_text'); ?></textarea></td>  
        </tr> 
        <tr valign="top">  
        <th scope="row">Normal Site Link</th>
        <td><textarea name="zeev_normal_site" cols="90"><?php echo get_option('zeev_normal_site'); ?></textarea></td>  
        </tr>  
         <tr valign="top">  
        <th scope="row">Mobile Site Link</th>
        <td><textarea name="zeev_mobile_site" cols="90"><?php echo get_option('zeev_mobile_site'); ?></textarea></td>  
        </tr>         
    </table>     
    <p class="submit">  
    <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />  
    </p>  
</form>  
</div>  
<?php }?>

i know that the "unexpected output" problem is coming from this file because when i delete all the php in it i don't get the problem. can you please help me fix it ? i uploaded it here: http://zeevm.co.il/zeev-mobile-new.zip

  • Aren't you're missing ` – Denis de Bernardy Jun 01 '13 at 10:41
  • no :) i put the part of the plugin without the beginning stuff (plugin author and things like that) – user2440873 Jun 01 '13 at 10:47
  • Maybe you've plenty of white space at the end, then... The error message is basically WP complaining that something is getting echoed when the file is included. – Denis de Bernardy Jun 01 '13 at 11:15
  • this was the first thing i checked. cleared all the spaces in the file.. but still. this is really strange and it's not comming from one place. it's like all the PHP charts in this file are "unexpected" – user2440873 Jun 01 '13 at 11:23
  • Possible duplicate of [The plugin generated X characters of unexpected output during activation (WordPress)](https://stackoverflow.com/questions/4074477/the-plugin-generated-x-characters-of-unexpected-output-during-activation-wordpr) – T.Todua Dec 24 '18 at 00:06

1 Answers1

0

Per comments, the error message is basically WP complaining that something is getting echoed when the file is included.

From a cursory glance at your code, it looks like your <style> tag is getting echoed -- it's not scoped within a function. There might be other similar issues elsewhere in the plugin.

Denis de Bernardy
  • 75,850
  • 13
  • 131
  • 154