The module integrates Yandex Share API with Drupal, which allows site visitors to share the material on social networks, blogs, etc.
Yadnex Share - development of popular Russian search engine Yandex. It adds a block to the page with links to social networks sites, blogs etc.

The module allow to full configurate the view of Yandex Share.

Features of the module:

  1. Two types of initsializaatsii (automatic and standard);
  2. Display button Yandex Share for certain materials;
  3. Display button Yandex Share in the teasers or full-nodes;
  4. Language settings, type settings, service list settings;
  5. Full control of settings of the standard initialization;

Link to project page: http://drupal.org/sandbox/Plazik/1222210
For Drupal 6.x at the moment.

CommentFileSizeAuthor
Yandex Share settings.png166.88 KBPlazik
yandexshare.png20.43 KBPlazik
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ccardea’s picture

I just took a quick look at your project.

Licensing: no problems noted.
Module duplication: No duplication found.

Your .info file is missing a few items. Please check the module developers guide http://drupal.org/node/231036 and update the file. Make sure to change your project status to 'needs review' after you have made the changes.

This project still needs technical and security review.

The waiting time for a full review can be as long as 4-6 weeks. You can help to reduce the wait by contributing to the code review process. Please see http://groups.drupal.org/code-review for details on how to participate.

Plazik’s picture

Thanks.
Added missing info in yandex_share.info

Plazik’s picture

Priority: Normal » Critical

4 weeks have passed.

klausi’s picture

Priority: Critical » Normal
Status: Needs review » Needs work

* Remove all old CVS $Id tags from your files, not needed anymore
* Don't mix "Implements hook_xxx()" and "Implementation of hook_xxx()" in your doc blocks. Choose one.
* Are you sure you want to implement hook_init()? It is invoked on literally every page even if your module has nothing to do there.
* yandex_share_theme(): indentation errors, use 2 spaces everywhere.
* yandex_share_admin_settings(): doc block formatting is not correct, see http://drupal.org/node/1354#functions
* Remove the translations folder, translation is done on http://localize.drupal.org

Plazik’s picture

Status: Needs work » Needs review

Thanks for review. I rewrite my module.

  • Optimisation code
  • Fixed small bugs
  • Fixed doc blocks
  • Remove some forms in admin settings
  • Fixed yandex_share_theme()
  • Remove hook_init()
  • Remove old CVS $Id tags
  • Remove the translations folder
klausi’s picture

Status: Needs review » Needs work
  • It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
  • CHAMGELOG.txt: wrong line endings ('\r' but should be unix style '\n'). Run coder to check your code style http://drupal.org/project/coder
  • "//Get array for content types": comment formatting: there should be a space after "//" and a "." at the end
  • yandex_share_admin_settings(): indentation error on a nested #options array
  • "$button_img: use theme('image', ...) instead.
  • theme_yandex_share_auto(): there should be a new line between the previous function and the doc block. Also elsewhere.
  • theme_yandex_share_auto(): you should sanitize variables before embedding them into markup to avoid XSS.
Plazik’s picture

Status: Needs work » Needs review

It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.

Done. Move to 6.x-1.x

CHAMGELOG.txt: wrong line endings ('\r' but should be unix style '\n'). Run coder to check your code style http://drupal.org/project/coder

Done in CHANGELOG.txt and yandex_share.admin.inc. Coder module didn't found any problems.

"//Get array for content types": comment formatting: there should be a space after "//" and a "." at the end

Done in all comments.

yandex_share_admin_settings(): indentation error on a nested #options array

Done.

"$button_img: use theme('image', ...) instead.

Done.

theme_yandex_share_auto(): there should be a new line between the previous function and the doc block. Also elsewhere.

Done.

theme_yandex_share_auto(): you should sanitize variables before embedding them into markup to avoid XSS.

Done. Users can't be add new items into $type, $services, $language. I didn't sanitize it. $title, $url sanitize by check_plain and check_url.

sreynen’s picture

Status: Needs review » Needs work

Hi Plazik,

Please address these issues and set the status back to "needs review":

  • drupal_add_js("new Ya.share({\n element: 'ya_share" . $id . "',\n l10n: '" . $language . "',\n elementStyle: {" . $text . $type_style . $border_style . $link_underline . $link_icon . "\n 'quickServices': ['" . $services_standart . "']\n },\n link: '" . $url . "',\n title: '" . $title . '\',' . $image . $description . "\n popupStyle: {\n blocks: {\n '" . $popup_text . "': ['" . $services_standart_popup . "'],\n }" . $copy_paste_field . $vdirection . "," . $code_for_blog . "\n },\n});", 'inline', 'footer');

    This appears to include a JSON-formatted object. Rather than writing JSON out manually, which risks doing something wrong and also makes the code very difficult to read, you should put it in an object and use drupal_json() to format it as JSON. This will also allow you to take out a lot of the code before this, which is also formatting variables as JSON.

  • $output = '<div class="yashare-auto-init" data-yashareL10n="' . $language . '" data-yashareType="' . $type . '" data-yashareQuickServices="' . $services . '" data-yashareTitle="' . $title . '" data-yashareLink="' . $url .'"></div>';

    You should be wrapping all these variables in check_plain().

  • $output = '<a href="' . $url . '" title="' . check_plain($title) . '" target="_blank">' . check_plain($title) . '</a>\'';

    You should create this link HTML with the l() function.

Plazik’s picture

Status: Needs work » Needs review

Hi sreynen, thanks for review!

This appears to include a JSON-formatted object. Rather than writing JSON out manually, which risks doing something wrong and also makes the code very difficult to read, you should put it in an object and use drupal_json() to format it as JSON. This will also allow you to take out a lot of the code before this, which is also formatting variables as JSON.

I used drupal_to_js() function because I need to inline code into HTML. drupal_json() doesn't work in this situations.

You should be wrapping all these variables in check_plain().

I already wrapping all variables which can be added by users early in the code. I think I don't need wrapping constant variables. Or not?

You should create this link HTML with the l() function.

Done.

klausi’s picture

Status: Needs review » Needs work
Plazik’s picture

Status: Needs work » Needs review

Sanitization should always happen as close as possible to the actual output, i.e. it should happen in your theme function. Example: http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_image/6

Ok, I used check_plain and check_url only in my theme functions for variables which can be added/change by users. I didn't use check_plain and check_url for variables which can't be added by users (i.e. node id, lang code, boolean variables etc.)

theme_yandex_share_buttons(): use theme('image', ...) here

Done.

klausi’s picture

Status: Needs review » Needs work

Review of the 6.x-1.x branch:

  • Run coder to check your style, some issues were found (please check the Drupal coding standards):
    Severity minor, Drupal Commenting Standards, Internationalization, Drupal Security Checks, Drupal SQL Standards, Drupal Coding Standards
    
    sites/all/modules/pareview_temp/test_candidate/yandex_share.module:
     +10: [minor] Comment should be read "Implements hook_foo()."
     +35: [minor] Comment should be read "Implements hook_foo()."
     +139: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +193: [minor] Comment should be read "Implements hook_foo()."
    
    Status Messages:
     Coder found 1 projects, 2 files, 1 normal warnings, 3 minor warnings, 0 warnings were flagged to be ignored
    

This automated report was generated with PAReview.sh, your friendly project application review script. Please report any bugs to klausi.

manual review:
"'#options' => $node_types,": you must sanitize the node type labels here. a node type with the label <script>alert('XSS');</script> would result in a nasty javascript popup on your form. See also http://drupal.org/node/28984 the section about checkboxes. Sorry that I did not spot that earlier.

Plazik’s picture

Coder 6.x-2.x-dev says:

yandex_share.module
    severity: minor Line 10: Format should be * Implementation of hook_foo().
     * Implements of hook_menu().
    severity: minor Line 35: Format should be * Implementation of hook_foo().
     * Implements of hook_nodeapi().
    severity: minor Line 193: Format should be * Implementation of hook_foo().
     * Implements of hook_theme().

Coder 7.x-1.0 says what I have to use "Implements hook_foo()."
I change "Implementation" to "Implements" and fixed dot.

"'#options' => $node_types,": you must sanitize the node type labels here. a node type with the label

alert('XSS');

would result in a nasty javascript popup on your form. See also http://drupal.org/node/28984 the section about checkboxes. Sorry that I did not spot that earlier.

Thanks. Done.

Plazik’s picture

Status: Needs work » Needs review
doitDave’s picture

Checked the code and tested functionality; found nothing to mention.

Just a general point: Your module name refers to yandex, but actually your plugin really enables sharing with a lot of SN. IMO, you should rethink naming of your module and change the project description as well. With very few changes you would provide a useful and universal social share module.

May I also suggest that you implement hook_block, now or later?

Then, last point: I did not check that myself now and I read comment #1, but are you really sure there is no duplication issue (since some other "social share" projects already exist)?

Just to clarify, I find your code tiny and easy to set up.

Plazik’s picture

Thanks for review!

Your module name refers to yandex, but actually your plugin really enables sharing with a lot of SN. IMO, you should rethink naming of your module and change the project description as well.

The module named Yandex Share because it does not provide manual sharing. It's just integrate Yandex Share API http://api.yandex.ru/share/doc/dg/concepts/share-button-ov.xml with Drupal. Exactly Yandex Share API enables sharing with a lof of sites. Like AddThis module integrate AddThis.com widget.

With very few changes you would provide a useful and universal social share module.

Which changes do you want?

May I also suggest that you implement hook_block, now or later?

I don't think about it but if you need it I may implement it.

since some other "social share" projects already exist

But no one doesn't integrate Yandex Share API with Drupal. Yandex Share button also provide to automatic send statistic to Yandex Metrics (Drupal module) about user clicks in button (see http://clubs.ya.ru/metrika/replies.xml?item_no=3279)

Just to clarify, I find your code tiny and easy to set up.

I am planning to develop new features.

doitDave’s picture

Ah, okay, so all the SN buttons are generated by this yandex api then? That confused me since I could simply click "tweet" without ever having registered with yandex. Ok.

I just mentioned the "block" feature because I have built a SN sharing module myself (unreleased), and it provides a simple "social share" block to put wherever it fits into a theme. Advantage is that you could add it anywhere and not just for nodes, e.g. on a views result page or so. I thought I'd mention it because you might receive such a feature request sooner or later anyway ;)

Plazik’s picture

Ah, okay, so all the SN buttons are generated by this yandex api then?

Yes, buttons are generated by Yandex.

Ok, I will implement hook_block soon.

beanluc’s picture

Status: Needs review » Needs work

Regression reveals a little bit more new coding-style flaws:

  • Lines in README.txt should not exceed 80 characters, see the guidelines for in-project documentation.
  • Remove all old CVS $Id tags, they are not needed anymore.
    CHANGELOG.txt:34:- Remove old CVS $Id tags
    

This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.

Plazik’s picture

Status: Needs work » Needs review

Ok, I will implement hook_block soon.

I implement hook_block.

Lines in README.txt should not exceed 80 characters

Done.

Remove all old CVS $Id tags, they are not needed anymore.

Done.

I also change "Implements" to "Implementation" like Coder 6.x-2.x-dev says.

doitDave’s picture

Status: Needs review » Needs work

Automated review (Please keep in mind that this is primarily a high level check that does not replace but, after all, eases the review process. There is no guarantee that no other issues could show up in a more in-depth manual follow-up review.)

Review of the 6.x-1.x branch:

  • Run coder to check your style, some issues were found (please check the Drupal coding standards):
    Severity minor, Drupal Commenting Standards, Internationalization, Drupal Security Checks, Drupal SQL Standards, Drupal Coding Standards
    
    sites/all/modules/pareview_temp/test_candidate/yandex_share.module:
     +10: [minor] Comment should be read "Implements hook_foo()."
     +120: [minor] Comment should be read "Implements hook_foo()."
     +160: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
     +217: [minor] Comment should be read "Implements hook_foo()."
     +251: [minor] Comment should be read "Implements hook_foo()."
    
    Status Messages:
     Coder found 1 projects, 1 files, 1 normal warnings, 4 minor warnings, 0 warnings were flagged to be ignored
    
  • Drupal Code Sniffer has found some code style issues (please check the Drupal coding standards):
    
    FILE: ...709/sites/all/modules/pareview_temp/test_candidate/yandex_share.install
    --------------------------------------------------------------------------------
    FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S)
    --------------------------------------------------------------------------------
     9 | WARNING | Format should be * Implements hook_foo().
    --------------------------------------------------------------------------------
    
    
    FILE: ...p709/sites/all/modules/pareview_temp/test_candidate/yandex_share.module
    --------------------------------------------------------------------------------
    FOUND 2 ERROR(S) AND 5 WARNING(S) AFFECTING 7 LINE(S)
    --------------------------------------------------------------------------------
       6 | WARNING | Line exceeds 80 characters; contains 83 characters
      10 | WARNING | Format should be * Implements hook_foo().
     120 | WARNING | Format should be * Implements hook_foo().
     153 | ERROR   | Closing brace indented incorrectly; expected 2 spaces, found 4
     160 | ERROR   | Concat operator must be surrounded by spaces
     217 | WARNING | Format should be * Implements hook_foo().
     251 | WARNING | Format should be * Implements hook_foo().
    --------------------------------------------------------------------------------
    
  • All text files should end in a single newline (\n). See http://drupal.org/node/318#indenting
    ./yandex_share.install ./yandex_share.admin.inc ./yandex_share.info ./README.txt ./yandex_share.module ./CHANGELOG.txt
    

This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.

Manual additions:

  • Regarding those results and your recent comment, are you sure that you pushed your changes?
  • What exactly is meant by "Two types of initsializaatsii (automatic and standard)", is it meant to be "types of installation"?
  • There are still files in your master branch. You should replace them as described in http://drupal.org/node/1127732 at step 5.

HTH, dave

Plazik’s picture

Status: Needs work » Needs review

Thanks for review!

Automated review

Done.

Regarding those results and your recent comment, are you sure that you pushed your changes?

Yes, I'm sure. What's the problem?

What exactly is meant by "Two types of initsializaatsii (automatic and standard)", is it meant to be "types of installation"?

Sorry, it's means "types of initialization".

There are still files in your master branch. You should replace them as described in http://drupal.org/node/1127732 at step 5.

Done.

patrickd’s picture

Status: Needs review » Needs work

coding style looks quite good so far

Review of the 6.x-1.x branch:

  • Drupal Code Sniffer has found some code style issues (please check the Drupal coding standards):
    
    FILE: ...view/sites/all/modules/pareview_temp/test_candidate/yandex_share.module
    --------------------------------------------------------------------------------
    FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
    --------------------------------------------------------------------------------
      6 | ERROR | Whitespace found at end of line
     31 | ERROR | Comma required after last value in array declaration
    --------------------------------------------------------------------------------
    

This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.

Source: http://ventral.org/pareview - PAReview.sh online service

Plazik’s picture

Status: Needs work » Needs review

Thanks patrickd for review!

Review of the 6.x-1.x branch:

Done.

patrickd’s picture

Status: Needs review » Needs work

Hi wanted to have a deeper look at your .module, but this is really hard because there are only a few comments and it's all very compressed.

It would be much easer if you split big code blocks into smaller ones (depending on the functionality of the segment) and describing a little more in detail what you do and especially why your doing it.
Rather too much comments then too few ;-)

the variable_del function does the following:
db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
So you have to specifiy the deletion of each variable used in your code!
This variable_del('yandex_share'); is not enough.

MiSc’s picture

@Plazik has been contacted to ask if the application is abandoned.

After ten weeks with a status of needs work: the applicant may be contacted by a reviewer to determine whether the application was indeed abandoned. The action taken by the reviewer should be documented in the project application issue.

http://drupal.org/node/894256

Plazik’s picture

I will upload a new version of the module soon.

klausi’s picture

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

Closing due to lack of activity. Feel free to reopen if you are still working on this application.