Welcome Guest, Not a member yet? Register   Sign In
Helpers and Other Conventions
#61

(07-11-2016, 05:08 PM)ivantcholakov Wrote: IMO valid_email() should not be deprecated, I doubt that filter_var($address, FILTER_VALIDATE_EMAIL) covers possible valid values like these that include international domain names.

This is the email_helper version of valid_email() from CI3:

PHP Code:
if ( ! function_exists('valid_email'))
{
    /**
     * Validate email address
     *
     * @deprecated 3.0.0 Use PHP's filter_var() instead
     * @param string $email
     * @return bool
     */
    function valid_email($email)
    {
        return (bool) filter_var($emailFILTER_VALIDATE_EMAIL);
    }


This is the valid_email() method in CI3's Form_validation library:

PHP Code:
/**
 * Valid Email
 *
 * @param string
 * @return bool
 */
public function valid_email($str)
{
    if (function_exists('idn_to_ascii') && $atpos strpos($str'@'))
    {
        $str substr($str0, ++$atpos).idn_to_ascii(substr($str$atpos));
    }

    return (bool) filter_var($strFILTER_VALIDATE_EMAIL);


Checking the commit for the difference between the two functions also reveals that the Email library contains yet another copy of this function. The version of the function in the two libraries makes some attempt to deal with non-ASCII domain names, but the version in the email helper does not (probably because the email helper was deprecated over 3 years ago).
Reply
#62

I might have missed it however, is there a final list of helpers to be implemented? I'd like to contribute.
Long live CodeIgniter!
Reply
#63

(08-01-2016, 06:52 AM)prezire Wrote: I might have missed it however, is there a final list of helpers to be implemented? I'd like to contribute.

Thanks for your interest in helping out!

There's not an official list, yet. I will try to go through tonight or tomorrow to get a firm list together of what is staying, what's not, and what's unsure. Those will be opened as new issues over at GitHub. We're using that as both milestone/planning tool, as well as a bug-tracker.

There are a number of tasks on there already with the "Help Wanted" label applied. If there's something you're interested in, comment in that issue to let me know, and we'll discuss details there.
Reply
#64

(08-01-2016, 07:10 AM)kilishan Wrote:
(08-01-2016, 06:52 AM)prezire Wrote: I might have missed it however, is there a final list of helpers to be implemented? I'd like to contribute.

Thanks for your interest in helping out!

There's not an official list, yet. I will try to go through tonight or tomorrow to get a firm list together of what is staying, what's not, and what's unsure. Those will be opened as new issues over at GitHub. We're using that as both milestone/planning tool, as well as a bug-tracker.

There are a number of tasks on there already with the "Help Wanted" label applied. If there's something you're interested in, comment in that issue to let me know, and we'll discuss details there.

Cool! Will do. Thanks for the tips.
Long live CodeIgniter!
Reply
#65

Hello! I stumbled upon this topic, currently in need of a function you may add it or not later to the numbers helper, which may be integer_shorten(), just playing with words. What I didn't found in codeigniter was that. A function that could help me shorten my large numbers in order to display in neatly, without writing my own helper. I'm pretty sure there must be people that want it too: like transform 1,560,349 into 1.56 M, or 12,000 into 12K.
I think that could be an useful addition to the core of helpers.

Thanks in advance guys. Keep it going Wink
Reply
#66

helper('number');
Long live CodeIgniter!
Reply
#67

(12-10-2017, 05:40 PM)prezire Wrote: helper('number');

The byte_format function? Already outputs the symbol, doesn't help with currencies for example. But I get your point. Of course, I could trim those last characters and use what I want. Maybe a more 'universal' function to help with that would be cool.  Blush
Reply
#68

(This post was last modified: 12-19-2017, 10:28 PM by prezire.)

(12-19-2017, 01:57 PM)meta Wrote:
(12-10-2017, 05:40 PM)prezire Wrote: helper('number');

The byte_format function? Already outputs the symbol, doesn't help with currencies for example. But I get your point. Of course, I could trim those last characters and use what I want. Maybe a more 'universal' function to help with that would be cool.  Blush

Perhaps this might get a request and pushed someday https://gist.github.com/prezire/f58d7a0f...07124c9e9d. Please feel free to suggest or correct the issues.
Long live CodeIgniter!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB