Automattic / babble

Multilingual WordPress done right.
https://wordpress.org/plugins/babble/
245 stars 50 forks source link

Always undefined $leavename variable. #352

Open rjksn opened 8 years ago

rjksn commented 8 years ago

Why do you have a 100% undeclared variable? It will never be declared in this function.

    /**
     * Hooks the get_sample_permalink filter to provide a correct sample permalink
     * in situations where the post_name has been hacked for a particular context.
     *
     * @filter get_sample_permalink (not yet in existence, see http://core.trac.wordpress.org/attachment/ticket/22338)
     *
     * @param array $permalink The array, like array( $permalink, $post_name )
     * @param string $title A desired title (could be null)
     * @param string $name A desired post name (could be null)
     * @param int $id The Post ID
     * @param object $post A (hacked) Post object
     * @return array The array, like array( $permalink, $post_name )
     */
    public function get_sample_permalink( $permalink, $title, $name, $id, $post ) {
        $permalink[ 0 ] = $this->post_type_link( $permalink[ 0 ], $post, $leavename );
        return $permalink;
    }
benhuson commented 8 years ago

Also noting here that $leavename is not an optional parameter when calling $this->post_type_link(): https://github.com/Automattic/babble/blob/7f89ef408984f5399a9be8bf4394dfb4e46125b2/class-post-public.php#L597