CVS edit link for kpbowler

The module I have written allows you to a JW Player to a page using an input filter.

You can put players with different configurations on the page by choosing a different value for the filter.

You can add new 'Profiles', which the module detects, and adds the flash configuration variables to the player based on the ones specified by the profile.

The reason I created this module was because I wanted a way of adding media files to a page very easily, and a configurable input format seemed to be the perfect idea.

CommentFileSizeAuthor
#9 player.zip32.73 KBkpbowler
#3 player.zip81.98 KBkpbowler
#2 player.zip81.99 KBkpbowler
#1 player.zip82.09 KBkpbowler

Comments

kpbowler’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new82.09 KB

The included zip file includes all the source for the Player Module.

I have gone through all the source this morning and attempted to make it conform to the Drupal Coding Standards. Would appreciate someone with more Drupal experience looking over the code and letting me know if it is ready to be included in the Contrib repository or if it needs work. I am comitted to the future of this module, so would like to know where to go next.

Thanks.

Kev.

kpbowler’s picture

StatusFileSize
new81.99 KB

Sorry, I hadn't finished editing the .info file in the previous post.

This new file has the correct information in it.

kpbowler’s picture

StatusFileSize
new81.98 KB

Ok, Ive just ran the code through the code-style.pl script, and cleaned up as many of the issues as possible.

The ones that are left are all issues with either a regular expression that needs to check form the presence of upper case text, or are encased in strings which output javascript. These string must have uppercase letters in them for the javascript function names (swfobject.embedSWF for example).

avpaderno’s picture

Issue tags: +Module review
avpaderno’s picture

Status: Needs review » Needs work
  1. Remove any files that are not released under GPL; compatible licenses are not accepted in Drupal.org CVS.
  2.   $form['player'] = array(
        '#type'				=> 'fieldset',
        '#title'			=> t('Add a Profile'),
    

    In Drupal, only the first word is capital case; the other words are lower case.

  3. function player_install() {
      drupal_install_schema('player');
      variable_set('player_global_profile_name', 'Global Profile');
      variable_set('player_global_tag', 'player');
      variable_set('player_global_flashvars', '');
      variable_set('player_global_attributes', '');
      variable_set('player_global_params', 'allowFullScreen = true
    allowscriptaccess = always
    wmode = opaque');
      variable_set('player_global_extras', '');
      variable_set('player_default_extras_width', '320');  
      variable_set('player_default_extras_height', '240');
      variable_set('player_default_extras_version', '9');
      variable_set('player_default_div', 'audio_jw_player');
      variable_set('player_count', 0);
    }
    

    There is no need to set Drupal variables to a default value.

  4.   $schema['player_profiles'] = array(
        'decription' => t('Stores information about each profile'),
    

    Descriptions should not be passed to t() anymore; here there is another error too.

  5.   define(CDN_DEFAULT_SERVER, 'http://'.$_SERVER['SERVER_NAME']);
    

    Constants defined from the module must respect the namespace; here there is another error too.

  6. See the Drupal coding standards to understand how a module code should be written.
kpbowler’s picture

Ok, thank you for the feedback. I'll fix the issues above and re-submit.

One question though, is point three and error? Can I set Drupal variables here or not? Is there a rule over variable_set practice?

Thank you for your time.

Kev.

avpaderno’s picture

is point three and error?

The second paramenter of variable_get() is the value returned by the function when the Drupal variable has not been already set (in other words, it's the default value for the Drupal variable). It's perfectly useless to set a Drupal variable to its default value when variable_get() accepts a value that is used as default value.

kpbowler’s picture

Ok, that make sense. Thanks! Working on it now.

Kev.

kpbowler’s picture

StatusFileSize
new32.73 KB

New improved version:

Removed links to non - GPL files
Sorted out capitalization and spelling errors
Removed defaults for variable_sets
Removed t() form all descriptions
Cleaned up the use of $_SERVER by adding a function to check and clean the variable (uses drupal_valid_http_host and check_plain)
Added a License
Ran all files through code-style.pl - only errors are in strings to create Javascript

Hopefully this version is a bit better.

Thanks,

Kev.

avpaderno’s picture

Status: Needs work » Needs review

Remember to change the status, when you upload new code.

avpaderno’s picture

Status: Needs review » Needs work
  1. The file LICENSE.txt needs to be removed; Drupal.org CVS doesn't allow to commit that file.
  2.         $msg = t('Player Profile Added.');
    

    It should Player profile has been added.

  3.   if ($error) {
        drupal_set_message(t('There was an error.', 'error'));
      }
    

    The error message is not useful.

  4. The file player.theme.inc can be merged with the module file; there is no reason to use a file for just a function.
  5.   if ($sql && $headers) { 
        return generate_table($sql, $limit, $headers, $build_callback, $options_callback);
      }
      else {
        drupal_set_message(t('You must specify the SQL and the array of headers for the table.'), 'error');
      }
    

    If the error is not caused by input given by the user, then the error message should be avoided.

  6. Any strings that are shown in the user interface should be translatable.
  7. See the Drupal coding standards to understand how a module code should be written.
avpaderno’s picture

Status: Needs work » Closed (won't fix)

There have not been replies from the OP in the past 7 days. I am marking this report as won't fix.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes
Status: Closed (won't fix) » Closed (duplicate)
Related issues: +#748762: kpbowler [kpbowler]