Favicon creator using Real Favicon Generator API.
Features:
Created icons for:
- iOS
- Windows 8
- Firefox
- Android
- OpenGraph
- Coast
- Yandex
Requirements:
Drupal 7.x
Utilizes the farbtastic library which is included in core.
Installation:
Download and enable the module and any/all sub-modules.
Go to /admin/config/user-interface/favicon_generator configure and save the settings.
Go to Appearance settings (either general and/or theme specific).
Un-check 'Use the default shortcut icon.' if enabled.
Set a path to the icon file or upload a new image.
Save configuration.
It may take a few seconds to fetch and save the files.
Notes:
The icon file should be square and be at least 70x70 px, preferably 300x300 px or larger, for best quality - although the module will do it's best to resize small files.
Module Link:
https://www.drupal.org/sandbox/johncook/2378569
Link to git Repository:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/johncook/2378569.git favicon_generator
cd favicon_generator
Comments
Comment #1
ijortengab commentedHai,
- please add prefix in your title of Issue Post with [D7]
- change git clone with:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/johncook/2378569.git favicon_generatoryour current code for cloning git is only for you as maintener, not for public.
Comment #2
ijortengab commentedMy review use bartik theme.
1. In file favicon_generator.info
- Add this line:
configure = admin/config/user-interface/favicon_generator- You don't need define package if you set "package = Other". You should remove it.
2. in file favicon_generator.module inside function favicon_generator_theme_form_submit()
- Your code don't anticipate if $settings['favicon_path'] is empty string. It makes
image_get_info() return FALSE. Not all themes provide input for favicon_path.
3. Founds to many issue of coding standard in
http://pareview.sh/pareview/httpgitdrupalorgsandboxjohncook2378569git
Comment #3
john cook commented#1 Done
Comment #4
john cook commented#2 Done
Comment #5
john cook commentedComment #6
PA robot commentedWe 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 #7
sahil chadha commentedDone
Comment #8
john cook commentedComment #9
gaurav.pahuja commentedThere are multiple TODOs in this module that you mentioned.
One of most important one is related to access.
Please work on these issues and then submit for review.
Comment #10
john cook commentedAdded permissions for admin UI and some other fixes re: #9
Comment #11
sendinblue commentedfor review by me
Comment #12
sendinblue commentedManual Reviews
- Secure code
(*) Your admin functions are accessible by anon users because the hook_menu() has 'access callback' set to TRUE. Don't use this entry unless you provide your own access callback function.
- Coding style & Drupal API usage
(+) All of your variables should be removed by variable_del() function once uninstall
Comment #13
sendinblue commentedComment #14
john cook commentedRemoved debugging functions into a new file so not accessible on live sites and added install file to remove variables on uninstall. Re: #12
Comment #15
john cook commentedComment #16
john cook commentedAdded image resizing to remove sizing requirements.
Comment #17
john cook commentedModularized function to enable/disable the types of icons.
Comment #18
sagar ramgade commentedAutomated Review
Review of the 7.x-1.x branch (commit 7b12e08):
./favicon_generator.api.inc: all functions should be prefixed with your module/theme name to avoid name clashes. See https://www.drupal.org/node/318#naming
function hook_favicon_generator_admin() {
function hook_favicon_generator_spec(array $settings) {
No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.
Manual Review
line no 146 , $r = json_decode($response->data); since it is coming from the 3rd party, it needs to sanitized accordingly. For more info Check Santization functions
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 #19
sagar ramgade commentedComment #20
klausi@Sagar: "$r = json_decode($response->data);": is not a XSS security issue by itself, since no data is printed to HTML in this line. You only need to sanitize user provided data when actually printing something.
Comment #21
sagar ramgade commentedThanks, Now i read it carefully. It is not being used anywhere for printing.
Comment #22
john cook commentedDid adjustments suggested in #18 except Coding style part 1.
This is due to system_theme_settings_submit() needing to execute before the validation can take place. The validation attempts to fix the errors and, if it fails, can continue with the standard favicon implementation.
Comment #23
john cook commentedComment #24
wiifmHey John,
Nice work on the module, I actually have been doing all of this manually in Drupal, and wrote about this on my blog post, when someone mentioned you are creating this module.
My cursarely look over the module:
I am also keen to help with the development of the module, if you need the help.
Sean
Comment #25
john cook commentedHi Sean
I used the default favicon upload screen for three reasons.
I may duplicate this on the favicon generator admin screen so it can all be set up in one go, but it'll only change the default favicon.
I split it into sub modules so the site designer can request different platforms easily. I admit that the ones there at the moment might be better included but I am shortly going to add functionality for the Yandex browser (popular in Russia but unheard of anywhere else).
And since you mentioned it, I'm starting to think about having different favicon sources. So you could get favicon.ico from one place and the open graph image from another.
I hop this answers your question. Any thing please ask.
John
Comment #26
joachim commented> * Implements hook_settings().
Hasn't been a hook since something like Drupal 4.7.
> * @author JohnCook
Our coding guidelines recommend not putting author names in code -- this can deter future contributors. Credit will be in the git history.
> * Implements hook_form_submit().
That's not a hook either. Check the documentation at api.drupal.org ;) That should say something like 'Additional submit handler for the yada yada form'. ('Additional' since you're adding it in with form alteration).
Your code should probably know the contents of its own module folder... ;)
Comment #27
john cook commentedCompleted suggestions from #26
Comment #28
rikki_iki commentedManual Review
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 #29
john cook commentedAdded message to re-save theme settings as suggested in #28.
Comment #30
polaki_viswanath commentedHi
These are some suggessions which must be fixed,
Readme file
1. Spell check, change "moule" to "module".
Module file
1. Remove blank lines.
3. It would be better if you would add a configuration form for getting the api key and its settings values from site admin.
4. Remove unused variables from the code.
5. In the sub modules please remove unwanted blank lines from code.
favicon_generator.css file
1. Line length must not exceed 80 characters.
Please use http://pareview.sh for reviewing.
Thanks
Comment #31
john cook commentedRe: #30
Spell error fixed.
Lines wrapped in css file.
Module file
3. The API key is for the module not the site, therefor extra configuration is not necessary. It would also increase the difficulty is setting up the module - the site admin would need to go to a 3rd party to get the key.
1 & 5. Blank lines are there to aid readability.
4. I've looked through the code and could not find any unused variables.
Also, I've checked with http://pareview.sh and it shows no errors.
Comment #32
cfischer83 commentedGreat module! I can see using this a lot.
Here are some recommendations and observations:
Comment #33
john cook commentedComment #34
john cook commentedRe: #32
1. There was a change in the API to allow for Open Graph images (coming soon) where the icon needs to be 300x300. For the other icons 260x260 px is recommended. I have changed both documentation and code to reflect 300x300 recommended size.
2. I am part way through re-doing the errors. Most of the watchdog errors refer to errors communicating with realfavicongenerator.net. I will redo the error messages to be more helpful next.
Comment #35
john cook commentedRe: #32 part 2.
The module now provides more specific error messages when the site admin might be able to fix the problem. Although if the problem is with favicongenerator.net then the general 'try again later' message will still appear with more specific details in watchdog.
Comment #36
john cook commentedComment #37
john cook commentedComment #38
john cook commentedComment #39
polaki_viswanath commentedHi John
I have a suggession that when we uninstall the module the icon generated must be deleted along with the changed settings of default icon, since the generated icon is used for all the devices. I think it would be better to use the default icon if the module is not used in the site.
Thanks
Comment #40
john cook commentedHi polaki,
I'll have to have a think about your suggestion.
My plan is to allow the site admin to insert the required html into the template manually and disable / uninstall the module so that the site can be sped-up for uncached sites. Of course, automatically deleting the icons would break this functionality.
At the moment, when the module is disabled / uninstalled the site returns to the standard Drupal behavior.
Comment #41
nattsHi John, how is progress on this? I could review it for you when ready.
Comment #42
PA robot commentedClosing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #43
john cook commented@natts, sorry for the delay in replying.
I feel it's in a functional / usable state at the moment. Please feel free to review it at any time.
Comment #44
ajay_reddyManual Review
Individual user account
[Yes: Follows] the guidelines for individual user accounts.
No duplication
[Yes: Does not cause] module duplication and/or fragmentation.
Master Branch
[Yes: Follows] the guidelines for master branch.
Licensing
[Yes: Follows] the licensing requirements.
3rd party assets/code
[Yes: Follows] the guidelines for 3rd party assets/code.
README.txt/README.md
[No: Does not follow] the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
[Yes: Follows] the guidelines for project length and complexity.
Secure code
[Yes: Meets the security requirements]
Coding style & Drupal API usage
(*) Line 106: Potential problem: drupal_set_message() only accepts filtered text, be sure to use check_plain(), filter_xss() or similar to ensure your $variable is fully sanitized. (Drupal Docs) [security_dsm]
drupal_set_message($result, 'error');
This review uses the Project Application Review Template.
Found issues on Click here
Comment #45
prashant.cHi John,
(*)Line 106: Potential problem: drupal_set_message() only accepts filtered text, be sure to use check_plain(), filter_xss() or similar to ensure your $variable is fully sanitized. (Drupal Docs) [security_dsm]
drupal_set_message($result, 'error');
Comment #46
cherebedov.s commentedHi, please check your code in here.
http://pareview.sh/pareview/httpgitdrupalorgsandboxjohncook2378569git
You have a some issues. Thank's.
Comment #47
klausiThat minor coding standard errors are surely not application blockers, anything else that you found or should this be RTBC instead? Please do a real manual review.
Comment #48
cherebedov.s commented@klausi, ok, sorry.
Comment #49
harings_rob commentedHi,
I evaluated the module, and I have a few remarks.
These remarks a purely informational, and they should not block the application from passing.
1. In the _favicon_generator_download_and_save_icons function, you decode the response before you check if the response has errors, I would swap this, as it now is pretty confusing.
2. Avoid using variables named $r, they hold no information.
3. Improve inline documentation.
4. Non hook functions should be prefixed with an underscore.
5. There are a lot of coding standard issues. They are easy to resolve, so I suggest you do so.
I have no further comments. I think this module is ready for release.
Comment #50
harings_rob commentedComment #51
mlncn commentedApologies for the months-long delays in this, when it had clearly passed relevant reviews long ago. Thanks for your contribution! Congratulations, you are now a vetted Git user. You can promote this to a full project.
When you create new projects (typically as a sandbox to start) you can then promote them to 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.