Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.78k stars 894 forks source link

Elegant echoing: printf #960

Closed szepeviktor closed 10 years ago

szepeviktor commented 10 years ago

@barrykooij https://github.com/Yoast/wordpress-seo/blob/master/frontend/class-opengraph.php#L93

echo '<meta property="' . esc_attr( $property ) . '" content="' . esc_attr( $content ) . '" />' . "\n";

could be

printf('<meta property="%s" content="%s" />%s',
    esc_attr( $property ), esc_attr( $content ), PHP_EOL);
barrykooij commented 10 years ago

Sure, want to create a PR for it?

szepeviktor commented 10 years ago

Is this sample appropriate (for you)?

                        echo '<p><strong>' . __( 'Huge SEO Issue: You\'re blocking access to robots.', 'wordpress-seo' ) . '</strong> ' . sprintf( __( 'You must %sgo to your Reading Settings%s and uncheck the box for Search Engine Visibility.', 'wordpress-seo' ), '<a href="' . esc_url( admin_url( 'options-reading.php' ) ) . '">', '</a>' ) . ' <a href="javascript:wpseo_setIgnore(\'blog_public_warning\',\'robotsmessage\',\'' . esc_js( wp_create_nonce( 'wpseo-ignore' ) ) . '\');" class="button">' . __( 'I know, don\'t bug me.', 'wordpress-seo' ) . '</a></p></div>';

                        printf('<p><strong>%s</strong> %s <a href="javascript:wpseo_setIgnore(\'blog_public_warning\',\'robotsmessage\',\'%s\');" class="button">%s</a></p></div>',
                                __( 'Huge SEO Issue: You\'re blocking access to robots.', 'wordpress-seo' ),
                                sprintf( __( 'You must %sgo to your Reading Settings%s and uncheck the box for Search Engine Visibility.', 'wordpress-seo' ),
                                        '<a href="' . esc_url( admin_url( 'options-reading.php' ) ) . '">',
                                        '</a>' ),
                                esc_js( wp_create_nonce( 'wpseo-ignore' ) ),
                                __( 'I know, don\'t bug me.', 'wordpress-seo' ));
jdevalk commented 10 years ago

@szepeviktor Want to create a pull request? :)

szepeviktor commented 10 years ago

I realized that this PR is (would be) huge! May I proceed file-by-file?

jdevalk commented 10 years ago

yes of course!

jdevalk commented 10 years ago

Closing here, would still welcome your pull requests :)