Giter Site home page Giter Site logo

formsimple's People

Contributors

entuland avatar nliautaud avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

entuland diego14

formsimple's Issues

Better handling of missing language files or strings

The code that retrieves translations assumes that at least the en.php file exists. If the file doesn't exist, the function does not return any value. It should display a warning or something (eventually, this check / warning for basic assumptions should be made upon instantiation of the main FormSimple class)

If the translation isn't found in that language, the requested key gets sanitized and gives no evident clue to the end user that a string is actually missing - instead it would appear as if it picked the English string.

Depending on the requested key, the displayed text could be misleading or imprecise. Asking for the translation of form_error_token, for instance, it would return Form error token, standing for Already sent message.

Personally, I would return {FormSimple/form_error_token} instead (or even better, {FormSimple/xx_YY/form_error_token}, where xx_YY is the language code, as sometimes end users sloppily communicate errors without providing enough context).

I also think that the function in here:
https://github.com/nliautaud/FormSimple/blob/master/actions/action.php#L81
should simply make use of this one:
https://github.com/nliautaud/FormSimple/blob/master/FormSimple.php#L373
assuming the language files get merged as suggested in issue #5.

Consistency & conventions

First things that should be applied.
See branch pear-formatting.

  • trailing spaces
  • indentation
  • camelCase
  • lowercase true, false & null
  • control structures format
  • remove ?> at eof
  • ?

Enabled / disabled behavior

I am following the path of testing locally the various combinations after the fixes I've made on my copy of the pear-formatting branch, hunting for more problems before implementing new stuff.

Now testing the form after disabling the action execution from the settings panel I get a notice about an undefined variable in this line:
https://github.com/nliautaud/FormSimple/blob/master/FormSimple.php#L255

I would simply fix it by adding a "d" at the end as it obviously should be $this->enabled and not $this->enable, as for the declaration here:
https://github.com/nliautaud/FormSimple/blob/master/FormSimple.php#L25
but I'm not sure I understand the intention behind that chunk of code.

Assuming I fix it, $this->enabled normally returns true, being its default value:
https://github.com/nliautaud/FormSimple/blob/master/FormSimple.php#L50

That means that $this->message('form_error_disabled'); gets raised if and only if the panels' setting returns false and if the actual class instance is enabled, as for the following chunk:

if (!FormSimple::setting('enable') && $this->enabled) {
    // FormSimple is disabled
    $this->message('form_error_disabled');
}

If I change the test to: !FormSimple::setting('enable') || !$this->enabled then the error would be raised if either of the settings return false; would that reflect the original intention?

GetSimple i18n guidelines compliance

In order to ease the life of our translators and to allow end users to easily change whatever string they'd like to, the code should comply with:
http://get-simple.info/wiki/plugins:i18n
this would let the plugin strings get translated with this plugin:
http://get-simple.info/extend/plugin/translate/112/
or any other compliant tool.

Necessary action:

  • rename $FormSimple_lang to $i18n

Strongly suggested action:

  • delete all language files into FormSimple/actions/sendmail/lang and merge them with those into FormSimple/lang
    (I don't think we should expect the translation tools to scan the whole plugin folder looking for additional lang folders, and also, this would ensure that, at least at in the context of this plugin, there are no duplicate strings, something which I have fought with using a well known CRM system "out there", and which almost drove me crazy trying to fix its translations)

Optional action:

  • rename all the files to use the en_US form instead of just en, to allow for differentiation of British / American / Australian, Portuguese / Brazilian and the alike.

Internal variables polluting global namespace

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.