Analog to Social Share Privacy mediaWrapper provides a way to prevent visitors' data being sent to third party websites without their explicit interaction. Wile Social Share Privacy focusses on twitter, facebook and Google+, mediaWrapper addresses embeddable media players.

Project page: http://drupal.org/sandbox/musikpirat/1508144
git: git clone --branch 6.x-0.1-dev musikpirat@git.drupal.org:sandbox/musikpirat/1508144.git mediawrapper

This module is designed for drupal 6 but should be easily ported to drupal 7.

Reviews of other projects:
http://drupal.org/node/1510636#comment-5810212
http://drupal.org/node/1503782#comment-5808022 (Not a very lucky review, but maybe it counts anyway)
http://drupal.org/node/1509670#comment-5806328
http://drupal.org/node/1431790#comment-5817962
http://drupal.org/node/1447120#comment-5818060
http://drupal.org/node/1511560#comment-5818140

New reviews:
http://drupal.org/node/1426386#comment-5842412
http://drupal.org/node/1429208#comment-5842440
http://drupal.org/node/1458858#comment-5842468

Comments

patrickd’s picture

Status: Needs review » Needs work

Welcome!

Issue to fix:

while waiting for an in-depht review of your module you can start out fixing some coding style issues detected by automated tools:
http://ventral.org/pareview/httpgitdrupalorgsandboxmusikpirat1508144git-...

regards

musikpirat’s picture

Branch -> Should be fixed
README.txt is added
Translation folder is removed
Images moved to images/, .js moved to js/

Just run the ventral-check. Seems there is still a lot do for me. :)

http://ventral.org/pareview/httpgitdrupalorgsandboxmusikpirat1508144git

patrickd’s picture

Status: Needs work » Needs review

Nah, that's not so much, just minor things ;)

musikpirat’s picture

Maybe for you - I'm a java guy. :)
Issues are fixed.

musikpirat’s picture

Finally I managed to delete the invalid braches in git.

musikpirat’s picture

Issue summary: View changes

Switched from master to a branch

musikpirat’s picture

Issue tags: +PAreview: review bonus

Did three reviews. Hope they are good enough. :)

Also did some refactoring at the code to be even more easier to use.

klausi’s picture

Status: Needs review » Needs work
Issue tags: -PAreview: review bonus

Thanks for your reviews, just make sure that you pick applications that did not get a review in a long time.

manual review:

  • remove the empty folder "mediawrapper".
  • "drupal_add_js(drupal_get_path('module', 'mediaWrapper') . '/js/jQuery-mediaWrapper . js');": white space in the file name, does the inclusion even owrk?
  • "Implements filter_tips().": should be "Implements hook_filter_tips()."
  • "please read <a href="http://foo/bar">this</a> article.": wrong link.
  • mediaWrapper_doFilter(): use the respective drupal sanitization functions, see http://drupalscout.com/knowledge-base/drupal-text-filtering-cheat-sheet-...
  • mediaWrapper_doFilter(): do not build link markup yourself, use l() instead.

Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

musikpirat’s picture

Status: Needs work » Needs review

Hi Klaus,

thanks for your suggestions. Fixed everything - at least I hope so and pushed the module online.

I'm afraid I'll have to wait. My php/drupal knowledge is pretty basic and a in depth review of a module is far beyond my possibilities.

musikpirat’s picture

Issue summary: View changes

Added PAReview infos

musikpirat’s picture

Issue tags: +PAreview: review bonus

Ok, found some old stuff I could review.

Also did updated the project page. I will link to it as soon as this is an official module. Maintaining documentation at two pages would be a waste of time.

c-logemann’s picture

Status: Needs review » Needs work

Hello musikpirat,
I installed the module in a test system and successfully used a youtube video integration protected by your JS.
But because this is a subfolder the icons are not displayed. Your JS is building a path like example.com/sites/all/modules/mediawrapper/images/youtube-icon.png and not example.com/subfolder/sites/all/modules/mediawrapper/images/youtube-icon.png
By the way: What about license of the icons? Are you sure we can host this images on drupal.org? But this is a question for lawyers.
Additionally I found some german text in the JS file.

musikpirat’s picture

Hi Carsten,

the german text in the js are a fallback that comes only to use if you are using the js without drupal.

The images should work now (don't have a drupal installation in a subfolder to test that). As far as I can they, the images are legal to use. I took them either from wikipedia (marked as public domain) or from the projects site where they have been marked as free for use.

I'm afraid, I have to put some more time into the preprare process. If there is a link to a video url _before_ the media that should be wrapped, strange things start to happen...

musikpirat’s picture

Status: Needs work » Needs review

Next round. Added a new module that uses oembed to create thumbnails instead of the default images.

MrMaksimize’s picture

Oops your branch is name 6.x-0.x I think it should be 6.x-1.x

http://drupalcode.org/sandbox/musikpirat/1508144.git/blob/refs/heads/6.x... is very long should be around 80 chars

don't use camelcase for function names. those are only for objective stuff (classes, methods, etc)

function mediaWrapper_doFilter

$media = explode("]", $matches[0][0]);
$description = NULL;
$url = NULL;
$link = NULL;
$id = NULL;
$icon = NULL;

dont pre-initialize your variables into nulls.
http://drupalcode.org/sandbox/musikpirat/1508144.git/blob/refs/heads/6.x...

if ($key == "url") {
  $url = $value;
}
elseif ($key == "id") {
  $id = $value;
}
elseif ($key == "link") {
  $link = $value;
}

^ should probably be a switch statement
if (is_null($url))
You can just use the empty() function, since is_null will check for NULL not for an empty value

You also have a .save file committed - haven't seen one of those - is that maybe from your ide?
If so, add it to .gitignore

Also I think you should put mediawrapper_oembed into a separate subfolder

Both module names should not be camelcase

use single quotes, and double only when necessary - http://drupal.org/coding-standards#quotes

http://drupalcode.org/sandbox/musikpirat/1508144.git/blob/refs/heads/6.x...

You have some commented out code around that line ^

Do an overall read through of http://drupal.org/coding-standards and check your code agains that :) Helps a lot w/ review :)

Also make sure you follow the coding standards for documenting your functions - http://drupal.org/node/1354 and document your params for functions

musikpirat’s picture

Hi Maksim,

0.x has been choosen by intent. 1.x will be used as soon as this module is feature complete. :)

Camel cases are removed in function names and file names.

Using switch instead of if.

Variables have to be nullified due to the loop. Before I nullified them, very strange things happened... :) Extracted the code to a separate method.

The outcommented code is kind of "in progress". I'm thinking about to re-enable it to support the oembed_module even without imagecache. I hope this does not affect the review process too much. :)

The parameters are pretty self explaining. If is mandatory to document them to get the module promoted, I'll do so.

Things are commited.

patrickd’s picture

Assigned: Unassigned » patrickd
MrMaksimize’s picture

Gotcha. Cool. /me do wonder what interesting things, but purely for an educational sake ;)

patrickd’s picture

Status: Needs review » Needs work
Issue tags: -PAreview: review bonus
  1. Keep your commit messages a little more detailed then "fixed code", also have a look at Commit messages - providing history and credit
  2. Think about putting the _oembed submodule into it's own subdirectory (it's more structured and maybe wont work this way in d8)
  3. you're doing drupal_get_path('module', 'mediawrapper') in hook_init, but you already know where your module is by doing dirname(__FILE__) instead (works just faster)
  4. not sure but isn't the basepath already set at Drupal.settings.basePath ?
  5. don't spit sentences over multiple t()'s, this will make your module very hard to translate. use t()'s replacement patterns whenever possible
  6. I personally don't like this _do_-function naming, it's more common to name them [module]_[verb]_[object] (eg- mediawrapper_do_prepare to mediawrapper_prepare_text)
  7. never ever encapsulate text with t() in hook_menu() (and watchdog())
  8. your not deleting the used variables in your submodule on hook_uninstall()
  9. your using $st() but you've never set $st = get_t();
  10. drupal should already make sure that its temporary directory is writable, you don't have to duplicate this requirement

removed "review bonus" tag, you can add it again after you've done 3 more reviews, remember to pick old ones first
thanks

regards

patrickd’s picture

Assigned: patrickd » Unassigned
musikpirat’s picture

Status: Needs work » Needs review

To be honest, this is getting a little bit annoying. Most code I have is copied either from tutorials from d.o or from existing modules. Why are new modules handled that strict and once you are accepted, nobody cares anymore?

Anyway, I wanna get my module an official one, so I'll go on...

1) I thaught credits were meant for patches and such. I'll try to add more specific comments, bust most of the time I'm just fixing things, that are peanuts.
2) done
3) dirname(__FILE__) returns a path relative to /. This works for adding the js, but is useless for the images, since I need a path relative to the document root. Anyway I reduced it to a single call instead of two.
4) Drupal.settings.basePath contains the basepath - but I need the url where the images are stored.
5) Done.
6) I'm ok with both, so I replaced the names
7) One again, taken straight from a tutorial: http://drupal.org/node/206761 -> Fixed
8) Moved cleanup code from installer to uninstaller
9) Fixed.
10) Once again something copied from another module... Removed.

patrickd’s picture

Status: Needs review » Reviewed & tested by the community

hmm, I'm sorry for that, corrected the documentation you mentioned. (making everyone able to edit wiki pages is both, blessing and curse)
This whole process is about making sure you can write good secure code, we DO care what your doing afterwards, but we hope you take the lessons learned with you so we don't have care too much ;)

looks fine for me now

// btw, rather then relying on any wiki page you should always have a look at api.drupal.org and look how core does things (because it's [most of the time] right and not editable without beeing checked before)

musikpirat’s picture

Yeah, keeping everything in place can be quite troublesome if everybody is allowed to participate. Thanks for correcting the documentation - didn't even think about doing it myself. :)

Btw: I like the idea of the community process in general. I learned a lot about drupal and php and it is indeed important, that here is some control about officially released modules.

// thanks for having a look on the code again. :) I read some time in the API, but there are often comments too... ;)

musikpirat’s picture

Issue summary: View changes

Added three more reviews

musikpirat’s picture

Issue tags: +PAreview: review bonus

Three new reviews done.

klausi’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -PAreview: review bonus

manual review:

  • jQuery-mediaWrapper.js: Asterisk indentation errors in the first doc block.
  • The input filter has no label on the settings page on the left of the checkbox, only a description.
  • when adding the example media tag I get PHP notices after saving: notice: Undefined index: url in mediawrapper/mediawrapper.module on line 96. Make sure to enable PHP notices in your development environment.
  • mediawrapper_oembed.module: "'access arguments' => array('access administration pages'),": that permission is too generic, provide your own or reuse one that makes more sense.

Although the last point could be considered a security blocker for this approval, I'm not that strict today as I can see that you are highly motivated and you'll fix that ASAP anyway :-)

Thanks for your contribution, musikpirat! Welcome to the community of project contributors on drupal.org.

I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.

Thanks to the dedicated reviewer(s) as well.

musikpirat’s picture

Hi Klaus,

interesting. If I enable notices, I get some by other modules, but nothing from mine. Anyway, I prefixed the array stuff with @, so there will be no notice. Think this is ok, due to the empty check afterwards.

Thanks all for reviewing and the hints how to improve the module!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Added three new reviews