HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

New Addon

422422 Developer MVP
Saturday here so had some time to create a very basic Mod.
I try to upload it but keeps stating Could not analyze the addon file.

Not sure what the Go is there, as its all plain and simple stuff. Read thru http://vanillaforums.org/docs/pluginquickstart and
http://vanillaforums.org/docs/plugins and

I also downloaded sample file... just not sure what the go is.

So I have to go out now to a function and uploaded it to one of our dev domains.

Link: sitehelp.com.au/Emocss.zip

Hopefully one of the guys here can check it out and see what I have done wrong.

Its a Emoticon replacement , using pure css instead. Could be useful for very busy forums.

There was an error rendering this rich post.

Tagged:

Best Answer

  • ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓
    The comments you put after each item in the plugin info array are confusing the parser. We don't want to run php that is uploaded to our site so I just do some crude regex analysis and didn't account for comments in the plugin info array. If you remove those then the plugin should upload fine.

Answers

  • ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓
    The comments you put after each item in the plugin info array are confusing the parser. We don't want to run php that is uploaded to our site so I just do some crude regex analysis and didn't account for comments in the plugin info array. If you remove those then the plugin should upload fine.
  • 422422 Developer MVP
    I had already tried that, but still got an error. Will try once more when I get in the office, cheers Todd.

    Ste

    There was an error rendering this rich post.

  • 422422 Developer MVP
    Just ducked in office, made those changes, I still get : Could not analyze the addon file

    Download link is here: ( new ) http://www.sitehelp.com.au/Emocss.zip

    There was an error rendering this rich post.

  • UnderDogUnderDog MVP
    edited October 2011
    @422 get the sample file you were talking about, name it the way you want and upload it. Does that give you the same error message?
    What I noticed when I downloaded your .zip file is that you didn't include the directory of the plugin.
    I made a new .zip and uploaded it, but I also get the same error message, therefore I ask to get the sample file and upload it.
    In the meantime I'll dive into the PHP code to analyze the error message.
    Edit
    First result:
    \models\class.addonmodel.php line 388
    // Analyze and fix the file. if (isset($Path) && !$V1) { try { $Addon = UpdateModel::AnalyzeAddon($Path, FALSE); } catch (Exception $Ex) { $Addon = FALSE; $this->Validation->AddValidationResult('File', '@'.$Ex->getMessage()); } if (!is_array($Addon)) { $this->Validation->AddValidationResult('File', 'Could not analyze the addon file.'); return FALSE; } $Addon = array_merge($Stub, $Addon); } else { $Addon = $Stub; if (isset($Path)) { $Addon['MD5'] = md5_file($Path); $Addon['FileSize'] = filesize($Path); } }

    Edit2
    I think the error is in this piece of logic:
    try { $Addon = UpdateModel::AnalyzeAddon($Path, FALSE); } catch (Exception $Ex) { $Addon = FALSE; $this->Validation->AddValidationResult('File', '@'.$Ex->getMessage()); } The addon file (array) is analyzed. There is an exception that's caught. The $Addon variable is set to false and the message is ... hidden from screen by applying the '@' sign.
    Now we need to ask if @Todd can look at the validation result that's written in a File.

    Can you upload the sample file in the meantime please, to eliminate that it's all files that are having problems.

    There was an error rendering this rich post.

  • 422422 Developer MVP
    edited October 2011
    Hi underdog, I emulated emotify plugin, not sure why any of the code should fail. The php file is default.php which is the acceptable name, and shouldn't make much of a difference regarding folder structure because the CSS and js calls are correct. Plugin works perfect on our systems. If you figure it out I would be very grateful.

    Ste

    There was an error rendering this rich post.

  • 422422 Developer MVP
    Will do. By that you mean the demo sample plugin I mentioned in my first post ?

    Also a suggestion, because you have ability to add edits, they aren't time stamped in the thread , so gets confusing following the thread. When an edit is made in this way , could a time stamp also be added ? Would clarify things.

    There was an error rendering this rich post.

  • 422422 Developer MVP
    Ok tried to reupload example plugin ( says The addon key Example is already taken. )

    So not sure what to try next as I dont want to spam the addons with existing addons. Its no big deal, perhaps best to forget it.

    There was an error rendering this rich post.

  • 422422 Developer MVP
    Tried again to reupload with no success :(

    There was an error rendering this rich post.

  • LincLinc Detroit Admin
    You need to change the array key from 'Example' to the name of your plugin folder.
  • 422422 Developer MVP
    Cheers Lincoln, but my addon doesnt use the key "example" in fact this is the code within default.php
    // Define the plugin: $PluginInfo['Emocss'] = array( 'Name' => 'Emocss', 'Description' => 'Replaces emoticons in forum comments with css images.', 'Version' => '1.0', 'RequiredTheme' => FALSE, 'RequiredPlugins' => FALSE, 'HasLocale' => FALSE, 'Author' => "422", 'AuthorEmail' => 'steve@422.com.au', 'AuthorUrl' => 'http://30.com.au', 'License' => 'GPL v2', 'RequiredApplications' => array('Vanilla' => '2.0.17') ); /** * EMOcss * * This is a very simple plugin, which replaces image smileys with pure css simleys. * Thus it saves on server requests, each time an image is requested thats one trip back and * forth to your server. Got a thread with 50 posts, and 3 smileys in each post ? then pure css * can make sense **/ class EmocssPlugin implements Gdn_IPlugin { public function PostController_Render_Before($Sender) { $this->_Emocss($Sender); } public function DiscussionController_Render_Before($Sender) { $this->_Emocss($Sender); } private function _Emocss($Sender) { $Sender->AddJsFile('plugins/Emocss/emocss.js'); $Sender->AddCssFile('plugins/Emocss/emocss.css'); } public function Setup() { } }

    There was an error rendering this rich post.

  • If you'd like I have some pretty simple addons (see my sig)
    They have google code projects so you can easily browse the source if you like.

    There was an error rendering this rich post.

  • Also, you may find some interest in the development environment I have set up for each of them.

    I use eclipse to do development, there's a plugin for PHP development that works out rather well. I have an ANT build script that automatically generates the zip files necessary to upload my addon to the site here.

    There was an error rendering this rich post.

  • @Todd or @Lincoln ,
    When you find some time, please, could you update the approved status of my plugins?
    I've updated them and republished them with the new launch of .18
    TYVM in advance :)

    There was an error rendering this rich post.

  • ToddTodd Chief Product Officer Vanilla Staff
    @ddumont, done.

    @422, I tried downloading your plugin, extracting it, re-zipping and then uploading it and it worked no problem. I don't know why, but I guess our php zip library can't recognize your zip. I'll switch the author to you soon.
Sign In or Register to comment.