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

Added user friendly layout naming #779

merged 1 commit into from Mar 27, 2016


None yet
3 participants
Copy link

poocart commented Mar 25, 2016

Removed hardcoded layout name options array from layout select fields in page forms.
Added layout name parsing and page layout select field options array with names in page forms.
Added example layout names in demo themes.

Layout name can be added by adding @Layout name: *chosen name* attribute to layout PHP file. This can either be done with PHP <?php // @Layout name: *chosen name* ?> or HTML <!-- @Layout name: *chosen name* -->. Need to remember that HTML way shows the layout name to public in rendered website DOM.

Layout PHP files with underscore still ignored as being partials like in previous ImpressPages versions.

@maskas maskas merged commit c601bfa into impresspages:develop Mar 27, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
$file_contents = file_get_contents($themeDir.$filename);
preg_match_all("(@Layout Name:(.*)\n)siU", $file_contents, $file_layout);
if (isset($file_layout[1]) && isset($file_layout[1][0]) && !empty($file_layout[1][0])) {
$layout_name = preg_replace('/[^a-zA-Z0-9\s]/', '', $file_layout[1][0]);

This comment has been minimized.

Copy link

maskas Mar 27, 2016


I believe this preg_replace is redundant. I could imagine some russian agency building a custom template for their clients and willing to name the layout in cyrillic. In that case, layout name will become empty. I see no security or other reasons to restrict any characters in layout title. Would you mind if I remove this line?

This comment has been minimized.

Copy link

jankus Mar 27, 2016


Maybe restring length and special characters would be better? Now it's whitelisting. Changing to blacklist for php/html safety could be better.

maskas added a commit that referenced this pull request Dec 22, 2016

Merge pull request #779 from poocart/develop
Added user friendly layout naming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.