Wraps all images in content with a
set he caption text. If the ALT attribute is emmpty then the TITLE attribute
is used as a copy to ALT attribute and caption. If both attributes are empty
use a template string for caption with a sequential numbering. It does all
its work on the server.
Wrapping occurs prior Drupal renders the node content. Original content is
replaced with the new content only before rendering, thus the new content is
NOT saved anywhere. Ok, maybe in Drupals cached files but not anywhere else.
Works with CKEditor, Panels, Panels Everywhere. In CKEditor you just enter
the caption string in the text field "Alternative Text". In plain textarea add
attribute alt="Some description of my image.".
_._
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/MissterX/2319551.git img_capt
cd img_capt
_._
DrupalPractice: PAReview gives 34 WARNINGS which are false positives.
DrupalSecure: two (2) files (img_capt.module & img_capt.drush.inc) - how do I sanitaze base64_encoded string?
Comments
Comment #1
MissterX commentedEh - maybe I should not have assigned this to myself? Bugger...
Comment #2
anil280988 commentedHi MissterX,
There is no need to assign it to anyone. Changing it to Unassigned.
As for the code, few changes are required
Line 3, file README.html
If your are the <a href="/admin/config/media/img_capt/admin">siteadmin, use this link.</a>The link does not have the Base URL. So it will redirect on the 404 error page (see the screencast: screencast.com/t/nhnLhyDRD)
Line 252, file img_capt.module
Always use t() function for translation.
should be
Multiple lines, file img_capt.module
while comparing $form_state['values'] should be used as $form_state['input'] are raw and unvalidated.
Problem is $form_state['values'] ignores the default value. When the submission fails $form_state['values'] give the NULL value instead of the default value.
Line 3, file README.txt
Follows Guidelines content-wise although "About Image Caption & More" should be "Introduction". Also few Spelling errors are there.
Comment #3
luke_nuke commentedAutomated Review
For the beginning, you can addres the errors found by pareview.sh:
http://pareview.sh/pareview/httpgitdrupalorgsandboxmissterx2319551git
It found a lot of unused variables for example.
Manual Review
At the beginning of the img_capt_image_caption() function is this:
But it doesn't stop the function from going on, you need to return something beyond setting a message.
Also, If you are using html docs with images, I would consider to put them all in /docs directory .
This review uses the Project Application Review Template.
Comment #4
MissterX commentedanil289888
Thanks for your time and your review.
The screencast link did not work :(
Luke_Nuke
Thanks for your time and your review.
I did a PAReview prior creating this issue, please read the last two
lines of description above. I'm especially interested in the last one
concerning security.
the image is public domain
Comment #5
MissterX commentedComment #6
MissterX commentedPAReview performed after cleanup
$form_state['input']
The first 10 warnings are concerning that
$form_state['input']is referenced in code. Usage of that piece of code are based on Form element #default_value and AJAX, it seams to behave the same in D8: Checkboxes default value is ignored by forms system during processing of AJAX request.The code in this module does not utilize values in
$form_state['input'], it merrily unsets the textfield value prior setting the value in correct manner via$form_state['values']['text-field-name']WARNING | Unused variable ...
Four warnings, this warning is OK but it also is a false positive, it would be 100% OK if the values were mentioned only at lines 608 - 619 but they are filled with values at line 625. DrupalPractice sniffer is not expected to discover this, since line 625 could be a typing error which it is not in this case.
Drush command
Drush command
drush img-captis extended with the same functionality as the admin GUI:README.txt / README.html
Work in progress.Meanwhiledrush help img-captshould describe most of the functionallity. The admin GUI should be selfexplained. Updated, now drush can "accept" negative argument.Neither DrupalPractice sniffer nor the coder module reported anything for the other files.
Comment #7
rayzzz.com commentedAutomated Review
So far fix all problems listed here http://pareview.sh/pareview/httpgitdrupalorgsandboxmissterx2319551git
Manual Review
Individual user account
Yes
No duplication
Yes
Master Branch
Yes
Licensing
YES
3rd party code
Yes
README.txt/README.md
Yes
Code long/complex enough for review
Yes
Secure code
Yes
Coding style & Drupal API usage
Everything seems to be OK, but you should fix all errors listed on http://pareview.sh/pareview/httpgitdrupalorgsandboxmissterx2319551git
Comment #8
MissterX commentedIf anybody has info on how to fix the warnings, yes they are warnings and not errors, please post (link?). Meanwhile read post #6 above.
Comment #9
MissterX commentedCode changed by syggestion of IRC user ciss. Thank you!
Pareview gives
Comment #10
MissterX commentedCode fixed, removed pareview warnings about false positives.
Comment #11
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 #12
perennial.sky commentedHello MIssterX,
I saw your code, just found some issue
1. Variable name always be meaningful, please change some variable name you are using variable name link $s, $c_t.
2. Don't use #prefix and #suffix for a whole form if you want a wrapper in some form element then use #container.
https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.h...
3. Please use isset while taking data from any object or array,
if any node doesn't have anything in bode field then it will through an error
if ($setting['content_type'] == $node->type) {
$doc = $node->content['body'][0]['#markup'];
$node->content['body'][0]['#markup'] = img_capt_image_caption($doc, $node->type);
break;
4. please put module configuration link in module info file.
Comment #13
perennial.sky commentedComment #14
MissterX commentedHello akashjain132,
Code is changed, I give you +karma for issue no 2.
Thanks!
Comment #15
MissterX commentedSee comment #12.
Comment #16
shaxa commented1.
/**
* Implements hook_help_desc().
*/
function img_capt_help_desc() {
I don't think there is a hook_help_desc. So please add appropriate comments.
2.
$path = drupal_get_path('module', 'img_capt');
drupal_add_css($path . '/css/admin-page.css');
drupal_add_css($path . '/css/caption.css');
$help_file = file_get_contents(drupal_get_path('module', 'img_capt') . '/docs/README.html');
First you use $path then you call drupal_get_path again maybe you forgot it.
3. Think about setting the permission "img_capt" maybe in the install hook for administrators
4. In project issue and sandbox add info that there is "libraries" dependancy
5.
else {
$loaded_setting = '0';
}
if ($loaded_setting == '0') {
$loaded_setting = 'Default';
}
Why not else { $loaded_setting = 'Default'; don't loose bytes in such things
6. Do not use:
drupal_add_css($path . '/css/admin-page.css');
drupal_add_css($path . '/css/caption.css');
to add css or drupal_add_js to add js in forms because on submit you loose them and if you have an error you wont have styling so
better use $form['#attached']['css'] and $form['#attached']['js']
7. There is no such thing:
/**
* Implements hook_admin_validate().
*/
8. img_capt_admin_validate is only called by img_capt_ajax_load_setting so you dont need to repeat this:
if (!user_access('administer img_capt')) {
drupal_access_denied();
drupal_exit();
}
9. Consider passing your $form_state by reference on all form functions for proper function declaration.
These are the things i saw on first glance for the first 2-3 hundred rows so please check and fix them and then i can continue with review
if needed.
Comment #17
k_zoltan commentedBased on @ShaxA review this module need some more love (work).
If you are still working on this module please perform the necesarry changes, othervise please help the webmasters work by closing this ticket.
Comment #18
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.