CVS edit link for daily_game

Playedonline.com has developed a module to post free flash games to Drupal-based sites.
The module is called "Daily Game".

At playedonline.com we manage an extensive flash games catalog, that's updated daily with the best and newest games around the web. The games are sent directly to our subscribers' site, with no hassle on their side.
The module is flexible and allows customization of the content along with the option to reduce the number of posted games. It also creates new options for monetizing the site as pre-roll ads for games can be easily added.

Currently the system successfully works with VBulletin and Wordpress, and now it's ready to go live on the Drupal platform.

For more questions or remarks feel free to contact us directly at ilya@playedonline.com

Comments

daily_game’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new3.11 KB

The new Daily Game module files

avpaderno’s picture

Status: Needs review » Needs work
Issue tags: +Module review

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.

As per http://drupal.org/cvs-application/requirements, the motivation message should be expanded to contain more details about the features of the proposed module/theme; for modules it should include also a comparison with the existing solutions, while for themes a screenshot is also required.

daily_game’s picture

Status: Needs work » Needs review

Hi
Thanks for your quick reply, too bad I didn't see it on time...

I'm not sure how I can edit the description and the motivational message so I'll just add here, hope it works fine :

As for the module's features I'll add some more details :
The service is a turn-key solution for automatically adding free content - online flash games. Each game is embedded in a separate node, with a thumbnail, description and instructions. The settings screen allows customization of the node's title template, the author of the posts and addition of adverts that appear while the games load. The daily game doesn't have to be actually "daily" and can be configured to post new games on specific days of the week - only on the weekends for example.

About the technical aspects - we are using the "Services" module to create a server that accepts requests from our site (run daily at 3am PST) and creates a new node for the new game after verifying a secret API key.

For a live demo please visit http://www.dailygame.org/

About similar solutions - I didn't find any modules that offer a service for adding free online games.

Thanks for your time and attention

Ilya Agron
Playedonline.com

avpaderno’s picture

Status: Needs review » Needs work
  1. See http://drupal.org/coding-standards to understand how a module should be written. In particular, see how functions, Drupal variables, global variables, and constand defined from a module should be named; how the code should be formatted.
  2. The module doesn't have an installation file that should remove the Drupal variables defined from the module. Drupal variables should be removed by calling variable_del(), and passing to the function a literal string containing the name of the variable to delete (using an SQL query that deletes all the variables with a name starting with the module name would remove variables of a module named daily_game_advanced, in example).
  3.     $gotd_message .= '</div><br/>';
    
        $gotd_message .= $sXML["description"];
        
        if ($show_instructions and $sXML["instructions"] != '') {$gotd_message .= "<br/><b>Instructions:</b><br/>" . $sXML["instructions"];}
    
        $gotd_message .= '<br/><br/><div style="text-align:center; font-size:smaller;"><a href="' . $sXML["game_url"] . '" style="text-decoration:none;">' . $sXML["game_name"] . '</a> is ' . urldecode($sXML["links"]) . '</div>';
    
        return t($gotd_message);
    

    The first argument of t() must be a literal string; differently, the script that extracts the string to translate to create the translation template will not be able to extract the string, which would not be translatable (if not in the case another module uses the same exact string, but it's rather difficult it happens, when the string is dynamically changed).
    The function is passing too much HTML content to the function; it could be reduced if the module would use a CSS file for the CSS style it uses (it is rather recommended to not use inline CSS styles).

  4. t('<img src="http://playedonline.com' . $sXML["thumb_url"] . '" style="float:left; margin:0 10px;">
    

    It useless to pass to t() parts that cannot be translated; HTML tags are not translated, and if there isn't the possibility to use a different URL basing on the language (as it happens with Wikipedia), it is better to not put URL in a string to translate. That part is at the beginning of the string, and it is easy to avoid to pass it to t().

  5.         $node = new stdClass();
            $node->type = 'story';
    
            $node->title = $title;
            $node->body = generate_body($sXML, variable_get('daily_game_adcode'), 1, variable_get('daily_game_show_instructions', 1));
            $node->teaser = generate_teaser ($sXML);
            $node->uid = variable_get('daily_game_uid');
            $node->status = 1;
            $node->promote = 1;
            $node->format = 2;
    
            node_save($node);
    

    The code is making assumptions about the content types currently defined from the Drupal site, and the input format associated to the content type. The content type Story could not exist (in fact, I removed that content type from my site when I installed Drupal); by default, the input filter a user can use is filter HTML, which would filter most of the HTML tags you are trying to use (including the JavaScript code).
    In such case, it is probably better if the module defines its own content type.

daily_game’s picture

Status: Needs work » Needs review
StatusFileSize
new4.33 KB

Thanks for the thorough review.
I've made the requested changes and updated the code for approval.

mrotolo’s picture

This looks pretty cool, let me know once it's approved I'd like to try it out.

daily_game’s picture

Priority: Normal » Major

Could a moderator please review our module?
It's been 2 months since we have suggested it...

avpaderno’s picture

Status: Needs review » Needs work
  1. The version line needs to be removed from the .info file.
  2. Hook implementation comments should be like the following one:
    /**
     * Implements hook_menu().
     */
    
  3. Empty hooks should be removed.
  4. /**
    * Implementation of hook_admin().
    */
    
    

    In Drupal 6, there isn't a hook_admin() hook; the function is simply a form builder.

  5.     '#description' => t("This key is meant to protect you from abuse. Please <a href='http://playedonline.com/register_blog'>register</a> to get a shared key."),
    
    

    See what I previously reported about using URLs inside strings to translate.

  6. function daily_game_perm() {
      return array('create daily_game', 'edit own daily_game');
    }
    
    

    Those permissions are already defined from node.module, which defines a set of permissions for each content type defined from third-party modules (including Drupal core modules).

  7. function daily_game_access($op, $node, $account) {
    
      if ($op == 'create') {
        // Only users with permission to do so may create this node type.
        return user_access('create daily_game', $account);
      }
    
      // Users who create a node may edit or delete it later, assuming they have the
      // necessary permissions.
      if ($op == 'update' || $op == 'delete') {
        if (user_access('edit own daily_game',$account) && ($account->uid == $node->uid)) {
          return TRUE;
        }
      }
    }
    
    

    See the code in node_example_access(), for how the hook should be implemented.

  8. /**
    * Implementation of hook_form().
    */
    function daily_game_form(&$node, $form_state) {
      $type = node_get_types('type', $node);
    
      echo $node->body;
    
      // We need to define form elements for the node's title and body.
      $form['title'] = array(
        '#type' => 'textfield',
        '#title' => check_plain($type->title_label),
        '#required' => TRUE,
        '#default_value' => $node->title,
        '#weight' => -5
      );
    
    
    

    hook_form() is supposed to return a form, not to print the node body.

  9. function daily_game_generate_teaser($req_data) {
        return '<img src="http://playedonline.com' . $req_data["thumb_url"] . '" style="float:left; margin:0 10px;"><div style="float:left;padding-top:5px;">' . $req_data["description"] . '</div>';
    }
    
    

    There is a Drupal theme function for images.

  10.     elseif ($req_data["game_name"] == "") {
            echo "Mailformed XML";
        }
        elseif ($enabled_days[$this_day] == "0") {
            echo "Plugin configured to not post today";
        }
    
    

    Strings used in the user interface should be translated.

avpaderno’s picture

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

I am closing this issue due to lack of replies.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes
Priority: Major » Normal

Please read the following links as this is very important information about CVS applications.