• Resolved bigwave2

    (@bigwave2)


    Hi,
    The sample code for checking against the host name doesn’t work. I believe that there should be two closing brackets after each $_SERVER['HTTP_HOST']

    add_filter( 'shc_show_env_id_env', 'my_show_env_id_env' );
    
    function my_show_env_id_env( $env ) {
        // match staging.example.com
        if ( preg_match( '/\bstaging\b/i', $_SERVER['HTTP_HOST'] ) {
            return array( 'Staging', 'staging' );
        }
        // match qa.example.com
        if ( preg_match( '/\bqa\b/i', $_SERVER['HTTP_HOST'] ) {
            return array( 'QA', 'qa' );
        }
    
        return $env;
    }

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Paul Biron

    (@pbiron)

    Please accept my appologies for the delayed response! For some reason I was never notified that you posted this.

    You are absolutely correct. I will be releasing a new version shortly and will be sure to correct that.

    Plugin Author Paul Biron

    (@pbiron)

    I just released v1.1. In that version I’ve removed the code sample (and other Dev Notes) from the readme and replaced it with a link to the documentation on github, which has been updated as you suggested.

    Also, that github documentation was been rewritten to hopefully be more clear.

    Thanx again for the report.

    Thread Starter bigwave2

    (@bigwave2)

    Thanks for the quick response (once you knew about it)

    Ian

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Invalid Sample Code’ is closed to new replies.