Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking mb_*() via function_exits() should be cached #9

Open
miya0001 opened this issue Jul 6, 2018 · 1 comment
Open

Checking mb_*() via function_exits() should be cached #9

miya0001 opened this issue Jul 6, 2018 · 1 comment

Comments

@miya0001
Copy link
Collaborator

miya0001 commented Jul 6, 2018

Because function_exists() is expensive to run.

function mbfunctions_exist() {
    static $test = null;

    if ( $test !== null ) {
        return $test;
    }

    $test =  (
            function_exists( 'mb_convert_encoding' ) &&
            function_exists( 'mb_convert_kana' ) &&
            function_exists( 'mb_detect_encoding' ) &&
            function_exists( 'mb_strcut' ) &&
            function_exists( 'mb_strlen' )
    );

    return $test;
}

This ticket should be opened as soon as we add some other i18n fixes.

@miya0001 miya0001 changed the title Checking mb_*() via function_exits() should be caced Checking mb_*() via function_exits() should be cached Jul 9, 2018
@miya0001
Copy link
Collaborator Author

miya0001 commented Jul 9, 2018

This tickets should be opened after some tickets are merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant