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

Escaping and CFS #16

Open
1 task
rcass opened this issue Mar 22, 2018 · 7 comments
Open
1 task

Escaping and CFS #16

rcass opened this issue Mar 22, 2018 · 7 comments
Assignees

Comments

@rcass
Copy link

rcass commented Mar 22, 2018

In your theme php files, remember to use escaping functions such as esc_html as a security standard (we want to make sure we are outputting what we think we are outputting). There is more about this in the security lesson slides as well!

  • Go through all your CFS calls in your php and wrap them in escaping functions.
@nikakey nikakey self-assigned this Mar 23, 2018
@Audrobot Audrobot assigned Audrobot and unassigned nikakey Mar 23, 2018
@Audrobot
Copy link
Collaborator

hey rose, just to be clear, am i to wrap both the CFS calls and echos? i'm not sure exactly which to use the esc_ functions. for example, in about.php we have carousels present with echos. will those need to be wrapped as well?

@rcass
Copy link
Author

rcass commented Mar 23, 2018

The escape function doesn't have to wrap the echo.

Basically it will look something like this:
<?php echo esc_html( CFS()->get( 'price' ) ); ?>

basically anytime there is a <?php echo CFS()->get( 'price' ) ?> it should be turned into <?php echo esc_html( CFS()->get( 'price' ) ); ?>

@Audrobot
Copy link
Collaborator

ah i see. so i can leave the lone echos alone and focus on the CFS gets then. i wasn't too sure about that after going through the documentation. thanks for clearing that up!

@Audrobot
Copy link
Collaborator

Audrobot commented Mar 25, 2018

sorry rose, i'm unsure about one thing.

do the CFS gets need to contain an echo?

should i be wrapping them in escaping functions if they don't have an echo?
e.g. $carousels = CFS()->get( 'about_carousel' );

wrap only the gets containing an echo?

@Audrobot
Copy link
Collaborator

also, there are a few CFS gets for the forms,
e.g. get( 'form_title' ); ?>

get( 'apply_here' ); ?>

i'm having issues wrapping these. tried html, textarea, and attr.

@Audrobot
Copy link
Collaborator

Audrobot commented Mar 25, 2018

hmmm, ya...
whenever i attempt to wrap the CFS gets it just displays the content you'd see in the wysiwig.

i input this:

<?php echo esc_html( CFS()->get( 'volunteer_perks_content' ) ); ?>

@Audrobot
Copy link
Collaborator

this displays:

screen shot 2018-03-24 at 8 50 59 pm

any suggestions? sorry so many messages!

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

No branches or pull requests

3 participants