Metatag Replace is used to either search or replace Meta tags on your site.
It uses batch API to search Meta tags and perform operations on them.
Module supports 4 fields which are provided by Metatag module https://www.drupal.org/project/metatag
*This module provides a form for user to search and replace Meta tags.
*There are options to select particular Content types .
*Whether we want case sensitive search or not.
*We can Match Exact Word or not.
*User can choose to select to perform operation Individual Meta Fields or All
*This Modules Creates Revision of each page it changes
Manual reviews of other projects
- https://www.drupal.org/node/2677382#comment-10910318
- https://www.drupal.org/node/2645832#comment-10890468
- https://www.drupal.org/node/2668062#comment-10885972
- https://www.drupal.org/node/2730511#comment-11254917
- https://www.drupal.org/node/2692493#comment-11256231
- https://www.drupal.org/node/2719763#comment-11227969
Project Page
https://www.drupal.org/sandbox/namit.garg92/2623618
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/namit.garg92/2623618.git metatag_replace
Comments
Comment #2
PA robot commentedGit clone command for the sandbox is missing in the issue summary, please add it.
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #3
namit.garg commentedComment #4
namit.garg commentedComment #5
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxnamitgarg922623618git
Fixed the git clone URL in the issue summary for non-maintainer users.
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #6
namit.garg commentedThere were no Errors found in pareview.sh
Comment #7
namit.garg commentedComment #8
bren001 commentedHi @namit.garg,
Automated Review
No issues reported by preview.sh
Manual Review
The README file doesn’t quite follow the README template as laid out on drupal.org: README template.
Implement hook_help(), see Help text standard for more info.
.
Notice: Undefined index: opn in metatag_replace_finish_batch_search() (line 511 of /home/r00e0/www/sites/default/modules/2623618/metatag_replace_admin.inc).
Notice: Undefined index: search-word in metatag_replace_finish_batch_search() (line 512 of /home/r00e0/www/sites/default/modules/2623618/metatag_replace_admin.inc).
Notice: Undefined index: replace-word in metatag_replace_finish_batch_search() (line 513 of /home/r00e0/www/sites/default/modules/2623618/metatag_replace_admin.inc).
The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
Comment #9
bren001 commentedComment #10
pankajsachdeva commentedAutomated Review
No issue reported by preview.sh
Manual Review
Comment #11
pankajsachdeva commentedNeeds work.
Comment #12
namit.garg commentedhi
@bren001,pankajsachdeva
Thanks for spending time to review my module
You were seeing the error because i had not added dependency on Metatag module. Now i have Added the dependency
For the module to work we would need to install Metatag Module.
1> After installalling Metatag Module you would be able to see the link in Menu.
I have also Changed ReadMe.txt and changed layout of Project page.
Also i have implement hook_help as per your advice
Thanks
Namit Garg
Comment #13
namit.garg commentedComment #14
namit.garg commentedComment #15
namit.garg commentedComment #16
namit.garg commentedComment #17
sandipauti commentedHello,
Please look into following error which i have found :
1. Please check Drupal coding standard: https://www.drupal.org/coding-standards
FILE: /var/www/drupal-7-pareview/pareview_temp/metatag_replace.module
---------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------
64 | WARNING | Open page callback found, please add a comment before the
| | line why there is no access restriction
---------------------------------------------------------------------------
2. Found some spelling errors in your code.
./metatag_replace_admin.inc:165: Dont ==> Don't
./metatag_replace_admin.inc:180: Dont ==> Don't
Overall thanks for your hard work.
Cheers,
Comment #18
namit.garg commentedHi @sandipauti
I have fixed the issues by pareview and changed the open page callback
Thanks
Comment #19
sandipauti commented@namit.garg, looks good for me.
Comment #20
namit.garg commentedComment #21
marabak commentedHi,
When i performed a search i had this notices :
You should perform some checks, maybe for instance replace in metatag_replace.tpl.php on line 37 :
with:
Comment #22
marabak commentedin fact the problem occurred in #21 when i click directly on "replace" button and my searched metatag is not found
Comment #23
marabak commentedI found an other problem. I dont think it's a good idea to use so general session variables:
$_SESSION['show-result']you should probably prefix them with your module name.
Comment #24
marabak commentedyou have too much logic i think in your metatag_replace.tpl.php file.
Maybe you should split it to parts, maybe one for search and an other for replace...
I saw you were printing directly
see : https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_it...
Comment #25
shinde_kashmira commentedHi namit.garg,
I was going through your code and found that, you have not followed naming convention standards for submit & replace buttons in the form.
Please look into the below code line #130 in metatag_replace_admin.inc.
metatag_replace_form_submit_one() function will confuse the user who is going to use this module in future.
Also for Replace button, please provide appropriate name for button and functions.
Comment #26
namit.garg commentedHi @ marabak,shinde_kashmira
Thanks for taking time to review my module.I have implemented the changes you suggested
1>I have prefix my module name in session variables
2>I have fixed the "Notice: Undefined index"
3>I Have now using theme function to print list items
4>I have changes the name of my submit and validation handlers
Please go through the module and see if it requires any other changes
Comment #27
tomvv commentedPareview.sh is fine with your module.
From manual checks I did find the following:
- Your tpl files contain PHP logic that should be handled outside of these files, using only the data coming from functions within your module rather than the tpl itself.
- Some code style issues, like mixing double quotes and single quotes, e.g. in the t() wrapper.
- Not really an error, but do see a lot of repeating logic, like
$replace_result = preg_replace("/\b$searchword\b/i", $replaceword, $meta_list);This cries for a helper function that can do the multiple preg_replace operations by handling an array.
- Same applies to repeating if/else statements.
Comment #28
namit.garg commentedHi @ tomvv
Thanks for reviewing my module.it took me a time to incorporate the changes you mentioned
1>I have reduced the logic in tpl files now only the data which is to be passes in theme function is written in those
2> fixed double quotes issue
3>I have reduced the repeating logic
Comment #29
klausimanual review:
There is a security issue in this module and as part of our git admin training I'm assigning this to Manjit so that he can take a look. If he does not get to it I will post the vulnerability details in one week. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #30
manjit.singhThanks Klausi for assigning the issue.
@Namit you have added some variables in template files that need to be sanitized before using.
Rest of things are fine.
@klausi Please correct me if there is anything else.
Comment #31
namit.garg commentedHi @manjit
Thanks for spending time to review my module.
These variables in template file are sanitized already .
User will enter $list[0]['search-word'] and $list[0]['replace-word'] only , for which i have used metatag_replace_xss_check() to check that they dont enter any invalid data.
$list[0]['opn'], $list[0]['field_result'] ,$list[0]['detail'], $list[0][matches] are the variables which are formed during operation so they will contain only valid data
Comment #32
namit.garg commented@klausi
Thanks for reviewing my modules . i have fixed some issues reported by you.
1> Removed drupal_session_start()
2>All user facing text are going through t()
3> Passed array instead of calling theme function
5>Instead of template files i have used theme function in my module file
6>metatag_replace_perform_replace() used a suitable varuiable name instead of $var1
7>metatag_replace_help(): changed doc block for the hook and also for other hooks
4> i am using $_SESSION as when user enters the field for search then if he see's the result and want any change in options or perform replace he did not need to fill entire form again, his previous filled options will be there
Please also tell the security issue in this module
Thanks
Comment #33
namit.garg commentedComment #34
damienmckenna@namit.garg: Hey, thanks for building on top of Metatag, I'm very happy to see you do this :)
I have one suggestion - add the same code check logic to the 'replace_box' field that you have for the 'search_box' field, and then I think it'd be a-ok. Also, I think the error message would be better as 'Do not enter any HTML or PHP code.'
If you make this one change I'll be happy to mark it as RTBC.
Comment #35
namit.garg commented@Damien McKenna
Thanks for reviewing my module.
There are 2 Validation functions
1> metatag_replace_form_search_validate() -> for search operation thus it will only check for search_box as their is no use for replace_box field
2>metatag_replace_form_replace_validate() -> This was missing call to metatag_replace_xss_check() for search_box which i have implemented now.
3>Changed Error Message as per your suggestion
Comment #36
namit.garg commentedComment #37
namit.garg commentedComment #38
namit.garg commentedComment #39
damienmckennaOk, the latest changes look good. Good work, namit.garg, that's an interesting module you've put together!
Comment #40
damienmckennaThanks for your contribution, Namit!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
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.
Thanks to the dedicated reviewer(s) as well.
Comment #41
namit.garg commentedThanks DamienMcKenna for accepting this as a full project .
I would read the documentation you provided tonight and will promote it to full project tomorrow.
Comment #42
pankajsingh.lko33@gmail.com commentedThanks Namit Garg
For your contribution to Drupal Community